The argument to
exec
is a
command_line
for another command.
exec
runs this command without creating a new process.
Some people picture this as
overlaying
the command
on top of the currently executing KornShell.
When the command exits, control returns to the parent of the shell.
Input and output redirections are valid in the
command_line
.
You can modify the input and output descriptors of the shell
by giving only input and output redirections in the command.
For example,
exec 2>errors
redirects the standard error stream to
errors
in all
subsequent commands run by the shell.
If you do not specify a
command_line
,
exec
simply returns a successful exit status.
The command:
exec 'cmd.exe'
overlays the MKS KornShell with a copy of
cmd.exe
.
If you specify
command_line
,
exec
does
not return to the shell.
Instead, the KornShell exits with the exit status of
command_line
or one of the following exit status values:
On Windows systems, it is impossible to implement a true version of
exec
, so it is implemented by spawning the command
and exiting the shell.
This may confuse a parent waiting on the shell, since the process id changes.
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation