PDA

View Full Version : [ubuntu] Open .sh files with double click..



rockoprem
May 28th, 2010, 09:40 AM
So, as the title says, I want to run a shell script (Matlab program) by double clicking on it. Presently, I can open it by either typing ./matlab in the terminal or by creating a launcher and choosing the 'run in terminal' option. Is there anyway to just run it with a simple double click? :-?

-humanaut-
May 28th, 2010, 09:56 AM
Try right-clicking on it make the default program it runs in gnome-terminal and make it executable.

rockoprem
May 28th, 2010, 10:01 AM
yup... using chmod +x, I made it executable.. and I can't choose a default program to run Matlab.. because, I am trying to run Matlan itself!

AJH101
May 28th, 2010, 11:26 AM
I may have got the wrong end of the stick but couldn't you right click and (under Permissions I think) tick the 'executable' box?

KdotJ
May 28th, 2010, 11:33 AM
When you double click on the file, doesn't it give you choice to display, run, or run in terminal?

ankspo71
May 28th, 2010, 11:51 AM
Hi,
It's probably best to place it in your home folder then create a menu shortcut the it, and the probable shortcut command might be:

sh /home/<user>/matlab.sh
Hope that helps.

rockoprem
May 28th, 2010, 12:00 PM
Hi, there is no problem in making the file an executable. Also, when i double click on it, it gives me the usual 4 options. None of them work. Infact, when I click on 'Run', the splash screen of Matlab is splashed for a few seconds and then it disappears! Matlab runs perfectly fine when I run it via the terminal, or create a launcher and run it in a terminal.. and I also tried placing it in the home folder, didn't quite seem to work! :(

Vishal Agarwal
May 28th, 2010, 12:29 PM
try put the shell script link in /bin folder.

ln -s /your shell script path/ /bin/link name

[change the required accordingly.]

rockoprem
May 28th, 2010, 02:47 PM
yup.. it is already in the bin folder... i also tried it with the 777 permission +x mode.. I also found some other links with similar kind of problems, I guess one has to fiddle around with the script itself..
http://www.linuxquestions.org/questions/programming-9/executing-shell-script-in-terminal-directly-with-a-double-click-370091/
http://macosx.com/forums/howto-faqs/41816-howto-open-terminal-shell-scripts-double-click.html

intrader
November 24th, 2010, 11:19 PM
When you double click on the file, doesn't it give you choice to display, run, or run in terminal?
Before Nov 10th it used to open .sh files in FAT volumes by simply doubleclick.
Now I don't know how to set the executable bit. The context-menu->Permission->Executable-checkbox toggles but reverts back to not executable.
The default application to open the file is set to Open Office not what I want.
The contents of the Pharo.sh file I am having problems with is: http://pastebin.ubuntu.com/536076/