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 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.
EXAMPLE
The command:
exec 'cmd.exe'
overlays the MKS KornShell with a copy of cmd.exe.
DIAGNOSTICS
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:
- 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.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems.
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.
NOTE
This is a special built-in command of the MKS KornShell.
AVAILABILITY
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
SEE ALSO
- Commands:
- sh
PTC MKS Toolkit 10.4 Documentation Build 39.