<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-01-11 23:01 GMT+01:00 Tommy Trussell <span dir="ltr"><<a href="mailto:tommy.trussell@gmail.com" target="_blank">tommy.trussell@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Sun, Jan 11, 2015 at 12:58 PM, Johnny Rosenberg<br>
<<a href="mailto:gurus.knugum@gmail.com">gurus.knugum@gmail.com</a>> wrote:<br>
><br>
> I don't really know what's happening here…<br>
><br>
> I use MEGA for storing file ”in the cloud”. I also installed ”megatools”, which are CLI tools for managing my files.<br>
><br>
> I wrote a script that does some things, including getting the http link from files online.<br>
> The command looks like this:<br>
> megals --export filename<br>
><br>
> Here's a working example:<br>
> $ megals --export "/Root/Projekt Johnny Guitar/03. Rock Nuts.flac" | awk '{print $1}'<br>
> <a href="https://mega.co.nz/#!JtgSmZjR!PC47fvH_nyktjMRY_6gE66plq-XH9fhGc8PuDjZKeeQ" target="_blank">https://mega.co.nz/#!JtgSmZjR!PC47fvH_nyktjMRY_6gE66plq-XH9fhGc8PuDjZKeeQ</a><br>
> $<br>
><br>
> Here's how I use it in my script:<br>
> OnlineFlacFolder="/Root/Projekt Johnny Guitar"<br>
> OnlineFlacFile="${OnlineFlacFolder}/${FileName}"<br>
> export OnlineFlacLink=$(megals --export "${OnlineFlacFile}" \<br>
> | awk '{print $1}')<br>
><br>
> When running my script from a terminal it works perfectly.<br>
> A soft link to the script is located in ~/bin and another one is located in ~/.local/share/nautilus/scripts<br>
> I can run any of these links from the terminal, it just works.<br>
><br>
> I want to run my script by right clicking a file in Nautilus, then select Script → MyScript,<br>
> but it seems like the ”megals” line doesn't run at all when running the script this way.<br>
><br>
> I tried to specify the search path to megals, but the result was the same:<br>
> OnlineFlacFolder="/Root/Projekt Johnny Guitar"<br>
> OnlineFlacFile="${OnlineFlacFolder}/${FileName}"<br>
> export OnlineFlacLink=$(/usr/local/bin/megals --export "${OnlineFlacFile}" \<br>
> | awk '{print $1}')<br>
><br>
> I have tried some more things but I don't remember them all right now…<br>
><br>
> Any ideas?<br>
> 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.<br>
<br>
<br>
</div></div>This is just a guess -- I haven't done a lot of shell scripting in<br>
Nautilus, but one thing I ALWAYS have done is specify the shell in the<br>
script. If you prefer Bash, make sure the first line is<br>
<br>
#!/bin/bash<br></blockquote><div><br></div><div>I do. My example was only a very small piece of my script. I should maybe have mentioned that…</div><div><br></div><div><br></div><div><div>Kind regards</div><div><br></div><div>Johnny Rosenberg</div><div>ジョニー・ローゼンバーグ</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I am not sure what shell the scripts will run in from Nautilus when<br>
you don't specify your shell. When you run scripts in the terminal, I<br>
believe whatever shell you normally use is assumed.<br>
<span class=""><font color="#888888"><br>
--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
</font></span></blockquote></div><br></div></div>