exec command (executes a command and exits)
- Organization of this page
Format
exec [command [args]...]
Description
This command executes a specified command and then exits.
If an external command is specified as the argument, it executes the command as a child process of the adshexec command. After waiting for the external command to complete, it performs postprocessing for the job, such as deleting temporary files.
If you specify only the input/output redirection symbol and a redirection target, it switches the input and output targets according to the input/output redirection symbol. For details about redirection, see 5.1.6(8) Input and output redirection.
Arguments
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
127 |
Error termination
|
Other than the above |
Error termination
|
Notes
-
If the command syntax of this special built-in command is invalid, it exits the shell that is executing the command.
Usage examples
-
Execute the user program UAP01 and terminate the job:
exec UAP01
-
Redirect the standard output destination to file01:
exec > file01