5.22. Running a Single Command with xterm -e
The -e option to xterm is useful
for running a single command before exiting. For example, if you just
want to run a character-based mail program, type the following:
% xterm -e mail
When you quit the mail program, the
xterm window exits.
The -e option needs to be the last
xterm option on the command line. The remainder of
the command line is assumed to be part of the command to be executed
by xterm. The new window has the command name in
its titlebar by default (unless overridden by
other command-line options (Section 5.15)).
One use for xterm -e is for running a window
with a login session to a remote system, like this:
% xterm -e ssh hostname &
Go to http://examples.oreilly.com/upt3 for more information on: ssh-agent
The xterm process runs on the local system, but
immediately logs you into the remote machine. You are prompted for a
password in the new xterm that pops
up -- before you can log in to the remote system. This
isn't as convenient as putting that command in your
X setup file (like .xinitrc or
.xsession) -- but it's far
more secure because you don't need to put your
hostname in your .rhosts or .shosts
file (Section 1.21),
which is a
potential security hole. (Or, if you use ssh for
your remote login -- and you start ssh-agent
before you start X -- you won't need to type
passwords at all during your X session. This is the handiest setup by
far.)
You can use -e to create a makeshift X display for
any character-based programs you like to run. For example, you might
want to keep track of messages sent to the console, but you
can't run xterm -C to get
console messages because you aren't actually logged
in on the console. You might run something like this:
tail -f Section 12.10
% xterm -e tail -f /var/log/messages &
Section 24.21 has more about how this works.
--LM, JP, and SJC
 |  |  | 5.21. Tips for Copy and Paste Between Windows |  | 5.23. Don't Quote Arguments to xterm -e |
Copyright © 2003 O'Reilly & Associates. All rights reserved.
|