bash: Invoking Bash
1
1 6.1 Invoking Bash
1 =================
1
1 bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o OPTION] [-O SHOPT_OPTION] [ARGUMENT ...]
1 bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o OPTION] [-O SHOPT_OPTION] -c STRING [ARGUMENT ...]
1 bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o OPTION] [-O SHOPT_OPTION] [ARGUMENT ...]
1
1 All of the single-character options used with the 'set' builtin
1 (⇒The Set Builtin) can be used as options when the shell is
1 invoked. In addition, there are several multi-character options that
1 you can use. These options must appear on the command line before the
1 single-character options to be recognized.
1
1 '--debugger'
1 Arrange for the debugger profile to be executed before the shell
1 Builtin:: for a description of the 'extdebug' option to the 'shopt'
1 builtin).
1
1 '--dump-po-strings'
1 A list of all double-quoted strings preceded by '$' is printed on
1 the standard output in the GNU 'gettext' PO (portable object) file
1 format. Equivalent to '-D' except for the output format.
1
1 '--dump-strings'
1 Equivalent to '-D'.
1
1 '--help'
1 Display a usage message on standard output and exit successfully.
1
1 '--init-file FILENAME'
1 '--rcfile FILENAME'
1 Execute commands from FILENAME (instead of '~/.bashrc') in an
1 interactive shell.
1
1 '--login'
1 Equivalent to '-l'.
1
1 '--noediting'
1 Do not use the GNU Readline library (⇒Command Line Editing)
1 to read command lines when the shell is interactive.
1
1 '--noprofile'
1 Don't load the system-wide startup file '/etc/profile' or any of
1 the personal initialization files '~/.bash_profile',
1 '~/.bash_login', or '~/.profile' when Bash is invoked as a login
1 shell.
1
1 '--norc'
1 Don't read the '~/.bashrc' initialization file in an interactive
1 shell. This is on by default if the shell is invoked as 'sh'.
1
1 '--posix'
1 Change the behavior of Bash where the default operation differs
1 from the POSIX standard to match the standard. This is intended to
11 make Bash behave as a strict superset of that standard. ⇒Bash
POSIX Mode, for a description of the Bash POSIX mode.
1
1 '--restricted'
1 Make the shell a restricted shell (⇒The Restricted Shell).
1
1 '--rpm-requires'
1 Produce the list of files that are required for the shell script to
1 run. This implies '-n' and is subject to the same limitations as
1 compile time error checking checking; Command substitutions,
1 Conditional expressions and 'eval' are not parsed so some
1 dependencies may be missed.
1
1 '--verbose'
1 Equivalent to '-v'. Print shell input lines as they're read.
1
1 '--version'
1 Show version information for this instance of Bash on the standard
1 output and exit successfully.
1
1 There are several single-character options that may be supplied at
1 invocation which are not available with the 'set' builtin.
1
1 '-c'
1 Read and execute commands from the first non-option argument
1 COMMAND_STRING, then exit. If there are arguments after the
1 COMMAND_STRING, the first argument is assigned to '$0' and any
1 remaining arguments are assigned to the positional parameters. The
1 assignment to '$0' sets the name of the shell, which is used in
1 warning and error messages.
1
1 '-i'
1 Force the shell to run interactively. Interactive shells are
1 described in ⇒Interactive Shells.
1
1 '-l'
1 Make this shell act as if it had been directly invoked by login.
1 When the shell is interactive, this is equivalent to starting a
1 login shell with 'exec -l bash'. When the shell is not
1 interactive, the login shell startup files will be executed. 'exec
1 bash -l' or 'exec bash --login' will replace the current shell with
1 a Bash login shell. ⇒Bash Startup Files, for a description
1 of the special behavior of a login shell.
1
1 '-r'
1 Make the shell a restricted shell (⇒The Restricted Shell).
1
1 '-s'
1 If this option is present, or if no arguments remain after option
1 processing, then commands are read from the standard input. This
1 option allows the positional parameters to be set when invoking an
1 interactive shell.
1
1 '-D'
1 A list of all double-quoted strings preceded by '$' is printed on
1 the standard output. These are the strings that are subject to
1 language translation when the current locale is not 'C' or 'POSIX'
1 (⇒Locale Translation). This implies the '-n' option; no
1 commands will be executed.
1
1 '[-+]O [SHOPT_OPTION]'
1 SHOPT_OPTION is one of the shell options accepted by the 'shopt'
1 builtin (⇒The Shopt Builtin). If SHOPT_OPTION is present,
1 '-O' sets the value of that option; '+O' unsets it. If
1 SHOPT_OPTION is not supplied, the names and values of the shell
1 options accepted by 'shopt' are printed on the standard output. If
1 the invocation option is '+O', the output is displayed in a format
1 that may be reused as input.
1
1 '--'
1 A '--' signals the end of options and disables further option
1 processing. Any arguments after the '--' are treated as filenames
1 and arguments.
1
1 A _login_ shell is one whose first character of argument zero is '-',
1 or one invoked with the '--login' option.
1
1 An _interactive_ shell is one started without non-option arguments,
1 unless '-s' is specified, without specifying the '-c' option, and whose
1 input and output are both connected to terminals (as determined by
11 'isatty(3)'), or one started with the '-i' option. ⇒Interactive
Shells, for more information.
1
1 If arguments remain after option processing, and neither the '-c' nor
1 the '-s' option has been supplied, the first argument is assumed to be
1 the name of a file containing shell commands (⇒Shell Scripts).
1 When Bash is invoked in this fashion, '$0' is set to the name of the
1 file, and the positional parameters are set to the remaining arguments.
1 Bash reads and executes commands from this file, then exits. Bash's
1 exit status is the exit status of the last command executed in the
1 script. If no commands are executed, the exit status is 0.
1