With your example, using the -e
option, then xterm
will start a shell, the manual states this.
It is possible to override xterm's default search for a shell, so you could supply your own program for this, but when you override the shell you cannot use the -e option. When you override the shell, then the your shell is run (fork() + exec()
) directly by xterm.
Here are the relevant sections,
One parameter (after all options) may be given. That overrides xterm's built-in choice of
shell program. Normally xterm checks the SHELL variable. If that is not set, xterm tries
to use the shell program specified in the password file. If that is not set, xterm uses
/bin/sh. If the parameter is not a relative path, i.e., beginning with “./” or “../”, xterm
looks for the file in the user's PATH. In either case, it constructs an absolute path. The
-e option cannot be used with this parameter since it uses all parameters following the
option.
and
-e program [ arguments ... ]
This option specifies the program (and its command line arguments) 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.
And just looking at what you are executing,
"echo hello; sleep 5"
It's the shell which parses that string, it uses the PATH
env variable to find the two commands, and realises that it is indeed two commands separated with the semi colon, xterm
doesn't do that!
xterm +ls -e "echo hello"
executesecho hello
indirectly by a shell, doesn't it? – Tim Nov 28 '18 at 00:50xterm +ls -e "echo hello"
executes a shell to executeecho hello
, doesn't it? – Tim Nov 28 '18 at 00:59xterm +ls -e '...'
still runs a shell, just not a login shell. You can easily check that by running a command that needs the shell (like something with;
) or by using, say,ps -p $$
– filbranden Nov 28 '18 at 01:28