PDA

View Full Version : gnome-terminal stay open on shell scripts



bkbilly
May 31st, 2009, 07:06 PM
If you are using shell scripts, then many of you may wonder how to make "gnome-terminal" make a command and then stay open...
I found this solution!
It was hard to find but i finally found it :p

To run a command using the terminal through a shell script you can put this:

gnome-terminal -e "fortune"the problem with this command is that it immediately closes...

The solution is this:

gnome-terminal -x bash -c "fortune ;bash"with this command the user can continue typing commands on his own...

If you want to close it after a period of time then you can use this:

gnome-terminal -x bash -c "fortune && sleep 2"this will close the terminal after 2 seconds

You must watch out for the bold commands to be right!
The command fortune is a command I chose! You can replace it with your own command.