O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required