Script works in terminal but not from Nautilus, very frustrating!
Johnny Rosenberg
gurus.knugum at gmail.com
Mon Jan 12 19:29:03 UTC 2015
2015-01-11 23:01 GMT+01:00 Tommy Trussell <tommy.trussell at gmail.com>:
> On Sun, Jan 11, 2015 at 12:58 PM, Johnny Rosenberg
> <gurus.knugum at gmail.com> wrote:
> >
> > 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.
>
>
> This is just a guess -- I haven't done a lot of shell scripting in
> Nautilus, but one thing I ALWAYS have done is specify the shell in the
> script. If you prefer Bash, make sure the first line is
>
> #!/bin/bash
>
I do. My example was only a very small piece of my script. I should maybe
have mentioned that…
Kind regards
Johnny Rosenberg
ジョニー・ローゼンバーグ
>
> I am not sure what shell the scripts will run in from Nautilus when
> you don't specify your shell. When you run scripts in the terminal, I
> believe whatever shell you normally use is assumed.
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20150112/71dfe391/attachment.html>
More information about the ubuntu-users
mailing list