bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o option] [-O shopt_option] [argument …] bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o option] [-O shopt_option] -c string [argument …] bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o option] [-O shopt_option] [argument …]
All of the single-character options used with the
(see The Set Builtin) can be used as options when the shell is invoked.
In addition, there are several multi-character
options that you can use. These options must appear on the command
line before the single-character options to be recognized.
extdebugoption to the
$’ is printed on the standard output in the GNU
gettextPO (portable object) file format. Equivalent to
-Dexcept for the output format.
~/.bashrc) in an interactive shell.
/etc/profileor any of the personal initialization files
~/.profilewhen Bash is invoked as a login shell.
~/.bashrcinitialization file in an interactive shell. This is on by default if the shell is invoked as
-v. Print shell input lines as they’re read.
There are several single-character options that may be supplied at
invocation which are not available with the
command_string, then exit. If there are arguments after the
command_string, the first argument is assigned to
$0and any remaining arguments are assigned to the positional parameters. The assignment to
$0sets the name of the shell, which is used in warning and error messages.
exec -l bash’. When the shell is not interactive, the login shell startup files will be executed. ‘
exec bash -l’ or ‘
exec bash --login’ will replace the current shell with a Bash login shell. See Bash Startup Files, for a description of the special behavior of a login shell.
$’ is printed on the standard output. These are the strings that are subject to language translation when the current locale is not
POSIX(see Locale Translation). This implies the
-noption; no commands will be executed.
shopt_optionis one of the shell options accepted by the
shoptbuiltin (see The Shopt Builtin). If
-Osets the value of that option;
+Ounsets it. If
shopt_optionis not supplied, the names and values of the shell options accepted by
shoptare printed on the standard output. If the invocation option is
+O, the output is displayed in a format that may be reused as input.
--signals the end of options and disables further option processing. Any arguments after the
--are treated as filenames and arguments.
A login shell is one whose first character of argument zero is
-’, or one invoked with the
An interactive shell is one started without non-option arguments,
-s is specified,
without specifying the
-c option, and whose input and output are both
connected to terminals (as determined by
isatty(3)), or one
started with the
-i option. See Interactive Shells, for more
If arguments remain after option processing, and neither the
-c nor the
option has been supplied, the first argument is assumed to
be the name of a file containing shell commands (see Shell Scripts).
When Bash is invoked in this fashion,
is set to the name of the file, and the positional parameters
are set to the remaining arguments.
Bash reads and executes commands from this file, then exits.
Bash’s exit status is the exit status of the last command executed
in the script. If no commands are executed, the exit status is 0.