0

I created a new document, opened it with gedit and the script is very simple and it works in terminal, basically something like this:

#!/bin/sh
sudo blah blah blah

But when I save it on the document, put on the execution tick in the properties and double click the file then gedit simply opens it again so what is there I should do to make the file work as a shell script to launch the command, I searched, but nothing answers my question because everywhere it says (or so I believe) that having the first line #!/bin/sh turns the document into a shell script.

1 Answers1

0

You have to make a desktop file, eg. name.desktop which contains the following structure:

[Desktop Entry]
Type=Application
Name=your script name
Exec=/path/to/your/script.sh  
Terminal=true     <-if you need sudo (to type your password)

Make both this file and your script executable (e.g. chmod 700 script.sh). Now you can double click your desktop file to launch your script.

EdiD
  • 4,457
  • 3
  • 26
  • 41