Running Bash Scripts in Ubuntu

Have you ever had the problem where you double click on a script file and it opens in the editor rather than executing? One problem might be that the execute bit on the file (Properties – Permissions – Allow executing file as a program) isn’t set. Alternatively, you may have to tweak Nautilus.

Open the Nautilus file manager and click on the gear wheel (Location Options) in the top-right corner of the window. Navigate to Preferences – File Preferences – Behaviour – Executable Text Files. A set of radio buttons allows the default option to be set. My preference is for “Ask each time”. Then, when I double click on a script file, I am given the option of either running the script or displaying (editing) its contents.

A secondary benefit to this option is that it causes the Terminal command window to be displayed and actions any included “Read” command to pause the command sequence. I often use this technique to check that a set of “if” statements have functioned as designed (e.g. to check if a given disk is mounted and “echo” a warning if it isn’t).


Ubuntu 13.04 – Execute scripts on double click

This entry was posted in Bash script, Tweaks. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s