Name
exec
Synopsis
exec [options] [command]
Description
Execute command in place of the current process (instead of creating a new process). exec also is useful for opening, closing, or copying file descriptors.
Options
- -a name
Tell command that it was invoked as name.
- -c
Remove all environment variables from the process when the new command runs.
- -l
Treat the new process as if the user were logging in.
Examples
$trap 'exec 2>&-' 0
Close standard error when shell script exits (signal 0) $exec /bin/tcsh
Replace current shell with extended C shell $exec < infile
Reassign standard input to infile
Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.