exec(1) User Commands exec(1)
exec, eval, source - shell built-in functions to execute other commands
source [-h] name
The exec command specified by the arguments is executed in place of
this shell without creating a new process. Input/output arguments may
appear and, if no other arguments are given, cause the shell input/out-
put to be modified.
The arguments to the eval built-in are read as input to the shell and
the resulting command(s) executed.
exec executes command in place of the current shell, which terminates.
eval reads its arguments as input to the shell and executes the result-
ing command(s). This is usually used to execute commands generated as
the result of command or variable substitution.
source reads commands from name. source commands may be nested, but if
they are nested too deeply the shell may run out of file descriptors.
An error in a sourced file at any level terminates all nested source
-h Place commands from the file name on the history list without
With the exec built-in, if arg is given, the command specified by the
arguments is executed in place of this shell without creating a new
process. Input/output arguments may appear and affect the current
process. If no arguments are given the effect of this command is to
modify file descriptors as prescribed by the input/output redirection
list. In this case, any file descriptor numbers greater than 2 that
are opened with this mechanism are closed when invoking another pro-
The arguments to eval are read as input to the shell and the resulting
On this man page, ksh(1) commands that are preceded by one or two *
(asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect
when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of
a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed
after the = sign and word splitting and file name generation are
If command is not found, the exit status is 127. If command is found,
but is not an executable utility, the exit status is 126. If a redi-
rection error occurs, the shell exits with a value in the range 1-125.
Otherwise, exec returns a zero exit status.
See attributes(5) for descriptions of the following attributes:
tab() allbox; cw(2.750000i)| cw(2.750000i) lw(2.750000i)|
lw(2.750000i). ATTRIBUTE TYPEATTRIBUTE VALUE AvailabilitySUNWcsu
csh(1), ksh(1), sh(1), attributes(5)
SunOS 5.10 17 Jul 2002 exec(1)