9.3.11 exec command (executes a command and exits)
Syntax
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 (8) Input and output redirection.
Arguments
- command
Specifies the command name of the command that is to be executed. If nothing is specified in this argument, the exec command does nothing, and execution of the job definition script continues.
- args
Specifies arguments for the command that is to be executed.
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.
Examples
Execute the user program UAP01 and terminate the job:
exec UAP01
Redirect the standard output destination to file01:
exec > file01