Click here to Skip to main content
15,881,852 members
Articles / Operating Systems / Linux
Tip/Trick

Start program on double clicking Shell script

Rate me:
Please Sign up or sign in to vote.
4.83/5 (5 votes)
2 Oct 2012GPL3 10.2K   92   4  
This shows how to start a program by double clicking a shell script in linux environment.

Introduction

This tip will let you know how to start a program both console and GUI from a bash script.

Note

Before starting mark your bash script or other dependent script as executable.

Self start

The following script will start itself in a console window then ask for root password to start another program named wvdial (Internet Dialer Tool).

if [ "$1" = "Start" ]; then
    sudo wvdial
else 
    konsole -e bash -i "$0" Start  #Konsole or Terminal whichever applicable
exit;
fi

Start in console

The following script will start another script in a console window.

konsole -e bash -i "path_to_the_Script"

Starting another  GUI program 

The following script starts a Python GUI code named Start.py residing in the same directory.

cd "$(echo $0| sed 's/\/[^\/ ]*.sh/\//g')"
./Start.py

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Systems Engineer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --