exec - Run commands and open, close, or copy descriptors
Synopsis
exec [ -c ] [ command [ argument ... ] ]
Description
The exec utility replaces qsh with command without creating a new process. The specified arguments are arguments to command. Any redirections affect the current environment.
When a command is not specified, any redirections are processed in the current environment. Any file descriptors greater than 2 that are opened by a redirection are not inherited when qsh invokes another program.
Options
- -c
- Run command with an empty set of environment variables.
Operands
Each argument is assigned in order to the positional parameters of command.
Exit status
Zero if no command is specified. Otherwise it does not return to qsh.
Examples
- Open a file for reading on descriptor 5:
exec 5<$HOME/input
- Close descriptor 5:
exec 5<&-