Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 16634  / 2 Years ago, fri, june 17, 2022, 8:05:52

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.


More From » gnome

 Answers
0

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.


[#36548] Saturday, June 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sipwing

Total Points: 245
Total Questions: 100
Total Answers: 118

Location: Aland Islands
Member since Thu, Oct 22, 2020
4 Years ago
;