3

For a suggested solution in another topic I tried to write my first shell script. It did not work as intended.

In order to get a quick access to the folder /opt/lampp/htdocs when using XAMPP I tried to create a desktop shell script:

gksudo nautilus /opt/lampp/htdocs

and saved it to a file named htdocs_open.sh and saved it on my desktop ("Skrivbord" in Swedish) under the folder /home/lars/Skrivbord

I also changed the permissions using:

chmod +x htdocs_open.sh

When I check the permissions it now looks like this:

-rwxrwxr-x  1 lars lars   35 jul 26 16:31 htdocs_open.sh*
-rwxrwxr-x  1 lars lars   34 jul 25 23:43 htdocs_open.sh~*

When I doubbleclick the icon on my desktop it just open up the script in gedit.

Why do I get a double set of files with one having "~" in the end? Why is my shell script not running as a shell script?

1 Answers1

0

I believe you will need to edit your script to look like this:

#!/bin/bash
gksudo nautilus /opt/lampp/htdocs

the tilde at the end of the filename ~ indicates that the file is a backup

Charles Green
  • 21,339
  • I updated the script as you suggested but it still just open up the script in gedit. – user309348 Jul 26 '14 at 15:14
  • Thanks, this hint in combination with a previous post, http://askubuntu.com/questions/286621/how-do-i-run-executable-scripts-in-nautilus, helped me. – user309348 Jul 26 '14 at 15:37