I've Googled around quite a bit on this, so just to let you know beforehand: chmod +x /file.sh changes nothing, nor does "sh /file.sh" nor "bash /file.sh"
With that out of the way ...
I'm trying to put a new item on my menu, the executable of which is an .sh file. The files works perfectly well if I navigate to it and click it - it asks if I want to run or display it - but when I add the .sh to the menu, nothing happens.
Stranger still, when I run "sh /file.sh" in the terminal, this works perfectly well. The same command in the menu does nothing.
Thoughts?
Running .sh from main menu
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
-
- Level 5
- Posts: 526
- Joined: Sat Jul 14, 2007 11:31 am
Running .sh from main menu
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Running .sh from main menu
At the beginning of your script your should have
And then instead of
just have
This might solve it...
P.S. Is this script supposed to run in a terminal? Then it would be different...
Code: Select all
#!/bin/bash
Code: Select all
sh /path/to/script.sh
Code: Select all
/path/to/script.sh
P.S. Is this script supposed to run in a terminal? Then it would be different...
Blog: http://drsjlazar.blogspot.com
Twitter: http://twitter.com/drsjlazar
Shared Stories: http://www.google.com/reader/shared/drsjlazar
IRC: shan3
Twitter: http://twitter.com/drsjlazar
Shared Stories: http://www.google.com/reader/shared/drsjlazar
IRC: shan3
-
- Level 5
- Posts: 526
- Joined: Sat Jul 14, 2007 11:31 am
Re: Running .sh from main menu
Strangely, the beginning of the script is actually "#!/bin/sh"shane wrote:At the beginning of your script your should haveAnd then instead ofCode: Select all
#!/bin/bash
just haveCode: Select all
sh /path/to/script.sh
This might solve it...Code: Select all
/path/to/script.sh
P.S. Is this script supposed to run in a terminal? Then it would be different...
Re: Running .sh from main menu
I'm not sure how much of a difference it makes... There are some tiny differences between sh and bash. In Mint the default shell is bash which is why my scripts start like that. Did you try running the script directly in the menu without 'sh'? That first line defines what kind of script it is and it should run automatically... just like when you double click.
Blog: http://drsjlazar.blogspot.com
Twitter: http://twitter.com/drsjlazar
Shared Stories: http://www.google.com/reader/shared/drsjlazar
IRC: shan3
Twitter: http://twitter.com/drsjlazar
Shared Stories: http://www.google.com/reader/shared/drsjlazar
IRC: shan3
Re: Running .sh from main menu
my /bin/sh is currently symlinked to /bin/dash (no idea why), but I think it might be to /bin/bash on a fresh install. In other words, if that is the case, it makes absolutely zero difference which line goes at the top of file
-
- Level 5
- Posts: 526
- Joined: Sat Jul 14, 2007 11:31 am
Re: Running .sh from main menu
Running it directly - using just the directory path - yields nothing.shane wrote:I'm not sure how much of a difference it makes... There are some tiny differences between sh and bash. In Mint the default shell is bash which is why my scripts start like that. Did you try running the script directly in the menu without 'sh'? That first line defines what kind of script it is and it should run automatically... just like when you double click.
I'm stumped, personally.