Name
exec
Synopsis
exec [options
] [command
]
Execute command
in place of the current
shell (instead of creating a new process). exec is also useful for
opening, closing, or copying file descriptors.
Options
- -a
name
Tell
command
that it was invoked asname
.- -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 Mac OS X Panther in a Nutshell, 2nd 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.