Running .sh from main menu

Questions about applications and software
Forum rules
Before you post please read how to get help

Running .sh from main menu

Postby red-e-made on Wed Apr 01, 2009 4:15 pm

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?
User avatar
red-e-made
Level 5
Level 5
 
Posts: 525
Joined: Sat Jul 14, 2007 11:31 am

Linux Mint is funded by ads and donations.
 

Re: Running .sh from main menu

Postby shane on Wed Apr 01, 2009 5:00 pm

At the beginning of your script your should have
Code: Select all
#!/bin/bash


And then instead of
Code: Select all
sh /path/to/script.sh


just have
Code: Select all
/path/to/script.sh


This might solve it...

P.S. Is this script supposed to run in a terminal? Then it would be different...
User avatar
shane
Level 6
Level 6
 
Posts: 1300
Joined: Sun Feb 25, 2007 11:15 pm

Re: Running .sh from main menu

Postby red-e-made on Wed Apr 01, 2009 5:22 pm

shane wrote:At the beginning of your script your should have
Code: Select all
#!/bin/bash


And then instead of
Code: Select all
sh /path/to/script.sh


just have
Code: Select all
/path/to/script.sh


This might solve it...

P.S. Is this script supposed to run in a terminal? Then it would be different...


Strangely, the beginning of the script is actually "#!/bin/sh"
User avatar
red-e-made
Level 5
Level 5
 
Posts: 525
Joined: Sat Jul 14, 2007 11:31 am

Re: Running .sh from main menu

Postby shane on Wed Apr 01, 2009 6:55 pm

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.
User avatar
shane
Level 6
Level 6
 
Posts: 1300
Joined: Sun Feb 25, 2007 11:15 pm

Re: Running .sh from main menu

Postby emorrp1 on Wed Apr 01, 2009 9:09 pm

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
If you have a question that has been answered and solved, then please edit your original post and put a [SOLVED] at the end of your subject header
Hint - use a google search including the search term site:forums.linuxmint.com
emorrp1
Level 8
Level 8
 
Posts: 2322
Joined: Thu Feb 26, 2009 8:58 pm

Re: Running .sh from main menu

Postby red-e-made on Wed Apr 01, 2009 10:20 pm

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.


Running it directly - using just the directory path - yields nothing.

I'm stumped, personally.
User avatar
red-e-made
Level 5
Level 5
 
Posts: 525
Joined: Sat Jul 14, 2007 11:31 am

Re: Running .sh from main menu

Postby el_b on Wed Apr 01, 2009 11:50 pm

It SHOULD be #!/bin/bash
Try it.
But, I THINK I got it. Try this on the launcher:

gnome-terminal location_and_name_of_file
bill_g >/dev/null
Image
User avatar
el_b
Level 2
Level 2
 
Posts: 75
Joined: Mon Mar 02, 2009 9:24 pm

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: Google Adsense [Bot], Jamesc359 and 16 guests