Page 1 of 1

run bash/sh from desktop (double click)

Posted: Fri Oct 07, 2011 2:21 pm
by ad.aimm
Hello,

How can i run bash/sh script from desktop with my mouse and double click ? Doesn't work with a launcher too.

thx u,

ad.

Re: run bash/sh from desktop (double click)

Posted: Sat Oct 08, 2011 9:06 am
by whatthefunk
Try creating a .desktop file for your script.

What OS are you using?

Re: run bash/sh from desktop (double click)

Posted: Sat Oct 08, 2011 3:06 pm
by LXNevermind
Create a script_name.desktop file. Inside this file write:

Code: Select all


[Desktop Entry]
Type=Application
Icon=script_icon_name 
Name=script_name
GenericName=script_name
Exec=lxterminal --working-directory=/path/to/your/script/directory -e ./your_script.sh
StartupNotify=true
Terminal=true
the most importatnt part is exec, the name and icon parts are irrelevant (i think;p).

Re: run bash/sh from desktop (double click)

Posted: Mon Oct 10, 2011 7:11 am
by ad.aimm
thx u, works fine :)

Re: run bash/sh from desktop (double click)

Posted: Mon Oct 10, 2011 6:42 pm
by LXNevermind
You're welcome. Please mark topic as solved.

Re: run bash/sh from desktop (double click)

Posted: Fri Mar 23, 2012 9:01 pm
by ionmich
LXNevermind wrote:Create a script_name.desktop file. Inside this file write:

Code: Select all


[Desktop Entry]
Type=Application
Icon=script_icon_name 
Name=script_name
GenericName=script_name
Exec=lxterminal --working-directory=/path/to/your/script/directory -e ./your_script.sh
StartupNotify=true
Terminal=true
the most importatnt part is exec, the name and icon parts are irrelevant (i think;p).
Following the above example I created a script (/home/knoppix/test2.sh) which reads...

Code: Select all

#!/bin/bash
less /home/knoppix/result.txt
... and provides the expect output when executed. Then I created in /home/Knoppix/Desktop a file which reads...

Code: Select all

[Desktop Entry]
Type=Applicatiom
Name=test1
Exec=lxterminal --working-directory=/home/knoppix -e ./home/knoppix/test2.sh
Icon=/usr/share/pixmaps/xscreensaver.xpm
GenericName=test1
Terminal=true
StartupNotify=true
An icon appears on my desktop which when clicked (or double-clicked) does absolutely nothing. All the files are executable and owned by "knoppix" the logged in user. What am I doing wrong?

Thanks.