I want to run a program from inside a bash script, such that it opens in a new command line window. How can I do this?
2 Answers
That really depends on the GUI you are using. Try some of the below for executing an ls command.
With gnome-terminal:
gnome-terminal -x bash -c "ls; bash"
With xterm:
xterm -e "ls; bash"
(taken from http://ubuntuforums.org/showthread.php?t=760006).
For konsole, take a look here:
or here:
2 Comments
SkypeMeSM
should I add terminal checks like "if [$TERM = "xterm"];then" in that case?
icyrock.com
This will not work - e.g. I have
TERM=xterm, but xterm is an unknown command, gnome-terminal is a right one in my case. You can do something like: gnome-terminal -x bash -c "ls; bash" || xterm -e "ls; bash" to first rune gnome-terminal and xterm only if it fails (note it will output "command not found") or use some more complex detection. If on one system, I wouldn't worry about that.