Difference between revisions of "Exec (Bash)"

From wikieduonline
Jump to navigation Jump to search
Line 7: Line 7:
  
 
       exec [-cl] [-a name] [command [arguments]]
 
       exec [-cl] [-a name] [command [arguments]]
               If command is specified, it replaces the shell.  No new process  is  created.  The
+
               If command is specified, it replaces the shell.  No new [[process]] is  created.  The
 
               arguments become the arguments to command.  If the -l option is supplied, the shell
 
               arguments become the arguments to command.  If the -l option is supplied, the shell
 
               places a dash at the beginning of the zeroth argument passed to command.  This  is
 
               places a dash at the beginning of the zeroth argument passed to command.  This  is

Revision as of 17:43, 14 November 2022

exec in Bash [1]


       exec [-cl] [-a name] [command [arguments]]
              If command is specified, it replaces the shell.  No new [[process]]  is  created.   The
              arguments become the arguments to command.  If the -l option is supplied, the shell
              places a dash at the beginning of the zeroth argument passed to command.   This  is
              what  login(1)  does.   The  -c  option causes command to be executed with an empty
              environment.  If -a is supplied, the shell passes name as the  zeroth  argument  to
              the  executed  command.   If  command  cannot  be  executed for some reason, a non-
              interactive shell exits, unless the execfail shell  option  is  enabled.   In  that
              case,  it returns failure.  An interactive shell returns failure if the file cannot
              be executed.  If command is not specified, any  redirections  take  effect  in  the
              current  shell,  and  the return status is 0.  If there is a redirection error, the
              return status is 1.


Related

See also

  • https://askubuntu.com/questions/525767/what-does-an-exec-command-do
  • Advertising: