PDA

View Full Version : 10.04: How to launch a .sh file with a link



temporos
August 21st, 2011, 07:31 PM
I have an executable .sh file that I would like to launch by clicking on a link in my "Internet" menu in the Netbook Remix. I've attempted to create a new link in the "Main Menu" control panel, but it won't launch. When I execute the .sh file directly (through Nautilus), I am always presented with a choice of editing or executing the file.

How can I make a link in the "Internet" menu that will execute this .sh file?

ubun2freak
August 21st, 2011, 07:37 PM
create new launcher -> type apps in terminal -> execute path is your sh file location -> OK done.
have fun.

drpjkurian
August 21st, 2011, 07:41 PM
Hi
Right click that .sh file and select properties. Select permission and tick the box stating 'file as executing programme'. Link your launcher to the .sh file by entering the location of .sh file

temporos
August 21st, 2011, 07:57 PM
create new launcher -> type apps in terminal -> execute path is your sh file location -> OK done.
have fun.


Hi
Right click that .sh file and select properties. Select permission and tick the box stating 'file as executing programme'. Link your launcher to the .sh file by entering the location of .sh file

Hey, guys. Thanks for the quick responses.

I already tried both of those methods, and neither one worked. When the terminal window pops up to execute the .sh file, it immediately closes, and the file is never executed. If I execute the .sh file directly, it runs after I choose to execute it.

drpjkurian
August 22nd, 2011, 04:13 PM
Hi
while creating the launcher select the tab'application' and select the option 'application in terminal'. In the box related to 'command',enter the path to the .sh file.I hope this should solve your problem

temporos
August 23rd, 2011, 12:19 AM
while creating the launcher select the tab'application' and select the option 'application in terminal'. In the box related to 'command',enter the path to the .sh file.

This was the idea that ubun2freak (http://ubuntuforums.org/showthread.php?p=11173767#post11173767) already proposed. It didn't work. When I click the launcher in the UNE (Ubuntu Netbook Edition) Internet display, the terminal window opens and disappears within one second.

The "application" (i.e., executable) bit only allows the file to be executed; it does not require the file to be executed. I think the system is confused about what to do with the file when called by the terminal window.

drpjkurian
August 23rd, 2011, 06:48 AM
May I know the content of .sh file?

lmarmisa
August 23rd, 2011, 07:12 AM
Did you add the shebang (http://en.wikipedia.org/wiki/Shebang_(Unix)) on the first line of your shell script?:



#!/bin/bash


Did you add the execute permission to your bash script file?. You can use Nautilus -> Select file -> Properties -> Permissions -> Allow executing file as program. You can type this command too:



chmod +x yourbashscript.sh

temporos
August 31st, 2011, 11:53 PM
Did you add the shebang (http://en.wikipedia.org/wiki/Shebang_(Unix)) on the first line of your shell script?:


#!/bin/bash


No, but I do have



#!/bin/sh

Can I use both?


Did you add the execute permission to your bash script file?. You can use Nautilus -> Select file -> Properties -> Permissions -> Allow executing file as program. You can type this command too:


chmod +x yourbashscript.sh


Yep. Did that a while ago. I know it will execute. It lets me execute it when I double-click on the icon itself in Nautilus, then select "run" from the dialog box that appears. But it won't execute from a link in the UNE launcher. I think it's because the launcher doesn't know what to do with it (i.e., open it in gedit or execute it).