Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an executable bash file run when clicked

I have a bash file that does some file manipulation. I don't want to have to open the terminal every time I run it. Is there a way to make the program run when I double click it? (Like a windows .exe file)

Thanks

like image 662
jamesatha Avatar asked Aug 21 '10 19:08

jamesatha


People also ask

Should Bash scripts be executable?

Before being able to run your script, you need your script to be executable. In order to make a script executable on Linux, use the “chmod” command and assign “execute” permissions to the file.


1 Answers

You can add a ".command" extension to the filename -- then double-clicking it will automatically open Terminal and run the script in a new window. Note: this assumes you still want to watch/interact with the script via a Terminal interface; if you want to avoid this as well, wrapping the script with Platypus, AppleScript, or Automator (as Zifei and Ned suggest) would be better options.

like image 78
Gordon Davisson Avatar answered Oct 26 '22 11:10

Gordon Davisson