run bash/sh from desktop (double click)

LXTerminal is the standard terminal emulator of LXDE - http://wiki.lxde.org/en/LXTerminal
Locked
ad.aimm
Posts: 2
Joined: Fri Oct 07, 2011 2:15 pm

run bash/sh from desktop (double click)

Post 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.
whatthefunk
Posts: 24
Joined: Sun Sep 11, 2011 3:19 am

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

Post by whatthefunk »

Try creating a .desktop file for your script.

What OS are you using?
LXNevermind
Posts: 34
Joined: Sat Sep 10, 2011 11:31 am

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

Post 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).
ad.aimm
Posts: 2
Joined: Fri Oct 07, 2011 2:15 pm

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

Post by ad.aimm »

thx u, works fine :)
LXNevermind
Posts: 34
Joined: Sat Sep 10, 2011 11:31 am

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

Post by LXNevermind »

You're welcome. Please mark topic as solved.
ionmich
Posts: 1
Joined: Fri Mar 23, 2012 7:05 pm

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

Post 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.
Locked