Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
From 'man xterm':
Quote:
-e program [ arguments ... ]
This option specifies the program (and its command line argu-
ments) to be run in the xterm window. It also sets the window
title and icon name to be the basename of the program being
executed if neither -T nor -n are given on the command line.
This must be the last option on the command line.
Thank you much. Thats just what I was looking for. Shortly after reading this I also found out how to do it in gnome-term. Anways thanks agian it helped alot.
I fond this email posting while searching solutions to the problem I have while tring to execute commands in new xterms from script. I my script I wrote:
xterm -e ls &
xterm -e date &
xterm -e pwd &
When I run the script, it opened up three terminals but they fade away, I'm not sure whether they has excuted commands. Any idea?
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
Quote:
Originally Posted by laurasong
I fond this email posting while searching solutions to the problem I have while tring to execute commands in new xterms from script. I my script I wrote:
xterm -e ls &
xterm -e date &
xterm -e pwd &
When I run the script, it opened up three terminals but they fade away, I'm not sure whether they has excuted commands. Any idea?
thanks,
Laura
The problem is that the commands that you are running end. When the command ends, the window closes. If you want to run this type of command and keep the window open, you can force a bash prompt. For example:
Code:
xterm -e ls\;bash &
The ';' separates commands, so the above issues two commands: 'ls' and 'bash'. The ';' has a backslash in front of it, because we want to send the ';' to xterm, not use it to end the xterm command.
Thanks a lot, I've tried it and it worked with xterm. I have changed my script to use gnome-terminal instead of xterm, somehow bash command won't work with gnome-terminal, I wonder why?
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
Quote:
Originally Posted by laurasong
Thanks a lot, I've tried it and it worked with xterm. I have changed my script to use gnome-terminal instead of xterm, somehow bash command won't work with gnome-terminal, I wonder why?
Thanks a lot!
Gnome-terminal works differently from xterm. The easiest way to do this with gnome-terminal is, for example:
Code:
gnome-terminal -e "bash -c ls\;bash"
This says to run gnome-terminal and pass it the command "bash". The bash command will be passed the option "-c" which causes it ro run the commands "ls" followed by bash as in the earlier xterm example.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.