14

Every time I want to run a .sh file, Ubuntu asks whether I want to Run in Terminal/Display/Run it. Is there a way to set default action for some sh files?

-- I am using Ubuntu 12.04 without any special changes.

2 Answers 2

22

Open Nautilus, then go to Edit -> Preferences. Open Behavior tab and you'll find the options to set the file manager behavior when you open executable text files.

2
  • 1
    well, isn't there a way to specify it only for some files? An option like: remember action for this file? Jul 27, 2012 at 14:49
  • I don't think so. Jul 27, 2012 at 15:04
5

Making each .desktop files for Run in Terminal or Display or Run , you can set default action for each sh files.

Execute authority is given to each .desktop files.

For example:

  • Run in terminal

Filename : sample-term.desktop

[Desktop Entry]
Type=Application
Name=Run in terminal
Exec='/fullpath_to_script/sample1.sh'
Terminal=true

Click this file, it will be able to run sample1.sh in terminal.

  • Display

Filename : sample-edit.desktop

[Desktop Entry]
Type=Application
Name=Edit script
Exec=gedit '/fullpath_to_script/sample2.sh'
Terminal=false

Click this file, it will be able to edit sample2.sh by gedit.

  • Run

Filename : sample-run.desktop

[Desktop Entry]
Type=Application
Name=Run script
Exec='/fullpath_to_script/sample3.sh'
Terminal=false

Click this file, it will be able to run sample3.sh.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .