Script works in terminal but not from Nautilus, very frustrating!

Johnny Rosenberg gurus.knugum at gmail.com
Sun Jan 11 18:58:37 UTC 2015


I don't really know what's happening here…

I use MEGA for storing file ”in the cloud”. I also installed ”megatools”,
which are CLI tools for managing my files.

I wrote a script that does some things, including getting the http link
from files online.
The command looks like this:
megals --export filename

Here's a working example:
$ megals --export "/Root/Projekt Johnny Guitar/03. Rock Nuts.flac" | awk
'{print $1}'
https://mega.co.nz/#!JtgSmZjR!PC47fvH_nyktjMRY_6gE66plq-XH9fhGc8PuDjZKeeQ
$

Here's how I use it in my script:
OnlineFlacFolder="/Root/Projekt Johnny Guitar"
OnlineFlacFile="${OnlineFlacFolder}/${FileName}"
export OnlineFlacLink=$(megals --export "${OnlineFlacFile}" \
| awk '{print $1}')

When running my script from a terminal it works perfectly.
A soft link to the script is located in ~/bin and another one is located in
~/.local/share/nautilus/scripts
I can run any of these links from the terminal, it just works.

I want to run my script by right clicking a file in Nautilus, then select
Script → MyScript,
but it seems like the ”megals” line doesn't run at all when running the
script this way.

I tried to specify the search path to megals, but the result was the same:
OnlineFlacFolder="/Root/Projekt Johnny Guitar"
OnlineFlacFile="${OnlineFlacFolder}/${FileName}"
export OnlineFlacLink=$(/usr/local/bin/megals --export "${OnlineFlacFile}" \
| awk '{print $1}')

I have tried some more things but I don't remember them all right now…

Any ideas?
The only line that doesn't seem to work in my script when run from
Nautilus, is that ”megals” line, everything else seems to work.



Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20150111/00218595/attachment.html>


More information about the ubuntu-users mailing list