Bash.Builtin.Exec (Bash v0.6.0)

Copy Markdown View Source

exec [-cl] [-a name] [command [argument ...]]

Replace the shell with the given command. If command is not specified, any redirections take effect in the current shell.

In our interpreter context, exec executes the command and signals that the shell should exit with that command's exit code.

Options:

  • -c - Execute command with an empty environment
  • -l - Place a dash at the beginning of the zeroth argument (login shell)
  • -a name - Pass name as the zeroth argument to the command

Exit Status: Returns success unless command is not found or cannot be executed.

Reference: https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html