MPE/iX Shell and Utilities Reference Manual, Vol 1

exec(1) MPE/iX Shell and Utilities exec(1)
NAME
exec — execute a command in place of the current shell
SYNOPSIS
exec [command_line]
DESCRIPTION
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 shell. 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.
DIAGNOSTICS
If you specify command_line, exec does not return to the shell. Instead, the shell exits with
the exit status of command_line or one of the following exit status values:
1-125 A redirection error occurred.
126 The command in command_line was found but it was not an executable utility.
127 The given command_line could not be executed because the command could not be
found in the current
PATH
.
If you did not specify command_line, exec returns with an exit value of zero.
Messages
Because this utility is built into the MPE/iX Shell, see the sh(1) man page for a complete list of
error messages that you may receive when using it.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems.
NOTE
This is a special built-in command of the shell.
1-212 Commands and Utilities