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,
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.
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:
A redirection error occurred.
The command in command_line was found but it was not an executable utility.
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.
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.
This is a special built-in command of the MKS KornShell.
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 MKS Toolkit 10.1 patch 1 Documentation Build 2.