PDA

View Full Version : [xubuntu] .sh (shell scripts) files on the desktop not executed when clicked



ziegler-g
September 16th, 2015, 09:10 PM
I have a little script nmrestart.sh on the desktop that I use to restart the network manager after a suspend or hibernate. The way to execute it is:
Click on the icon with the right mouse button and select "Open with Terminal". The permissions are rwxrwxr-x. So far, so good. I am the only member of my own group.

What does not work is to associate the terminal program to the script so that I just have to double click the icon. If I right click the icon, select "Open with other application", choose "Terminal" and "Always open with this program", the script runs. But only this one time. The next time I double click on the icon, nothing happens. So it seems impossible to associate .sh files to a certain program

ajgreeny
September 16th, 2015, 10:48 PM
Is this a a script that must run in terminal? Please show us the content of the script as it might help.

If it is you might do better to make a launcher (script.desktop) file for the Desktop with contents rather like this one of mine which first opens xfce4-terminal and then runs the script I have for the simple transfer program TransferOnLAN.

I do not normally run the script that way as it does not need to be run in terminal, but this was to show you how it might work for you; it certainly did work for me.


[Desktop Entry]
Version=1.0
Type=Application
Name=ToLan
Comment=Transfer files over LAN
Exec=xfce4-terminal -x /home/username/Downloads/TransferOnLAN-0.6.1/TransferOnLAN.sh
Icon=nm-device-wired
Terminal=false
StartupNotify=false

Just edit the pathway for the script and you should be good to go.