February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
If an argument is given, the command specified by the argument is executed in place of this shell without creating a new process.
Syntax
exec [argument ...]
Options
-c clears variables before execution.
-a assigns a different name to the command being run.
Oddities
Options -a and -c are available in ksh93 and beyond.
If no arguments are given, the effect of this command is to modify file descriptors through redirection.
File descriptors > 2 opened with exec are closed when the shell exits.
Example
$ ksh # Create new ksh $ $ print $$ # Display pid 4088 $ $ exec csh # Use exec to run a different shell % %echo $$ # Note pid is the same 4088 % %ksh # Run a different shell without using exec $ $ print $$ # Note different ...
Read now
Unlock full access