The command interpreter for the Bash shell (bash) can be invoked as follows:
bash [options
] [arguments
]
Bash can execute commands from a terminal, from a file (when the
first argument is a script), or from standard input
(if no arguments remain or if -s
is specified). The shell
automatically prints prompts if standard input is a terminal, or if
-i
is given on the command line.
On many systems, /bin/sh is a
link to Bash. When invoked as sh, Bash acts more like the traditional
Bourne shell: login shells read /etc/profile and ~/.profile, and regular shells read
$ENV
, if it is set. Full details are available in the
bash(1) manpage.
-c
str
Read commands from string str.
-D
, --dump-strings
Print all $"…"
strings in
the program.
-i
Create an interactive shell (prompt for input).
-l
, --login
Shell is a login shell.
-O
option
Enable shopt option
option. Use +O
to unset
option.
-p
Start up as a privileged user. Do not read
$ENV
or
$BASH_ENV
; do not import functions
from the environment; and ignore the values of the
BASHOPTS
, CDPATH
, GLOBIGNORE
, and
SHELLOPTS
variables. The normal fixed-name
startup files (such as $HOME/.bash_profile) are read.
-r
, --restricted
Create a restricted shell.
-s
Read commands from standard input. Output from built-in commands goes to file descriptor 1; all other shell output goes to file descriptor 2.
--debugger
Read the debugging profile at startup and turn on the
extdebug
option to shopt. For use by the Bash debugger (see
http://bashdb.sourceforge.net).
--dump-po-strings
Same as -D
, but output in GNU gettext format.
--help
Print a usage message and exit successfully.
--init-file
file
,
--rcfile
file
Use file as the startup file instead of ~/.bashrc for interactive shells.
--noediting
Do not use the readline library for input, even in an interactive shell.
--noprofile
Do not read /etc/profile or any of the personal startup files.
--norc
Do not read ~/.bashrc. Enabled automatically when invoked as sh.
--posix
Turn on POSIX mode.
--verbose
Same as set -v
; the shell
prints lines as it reads them.
--version
Print a version message and exit.
-
, --
End option processing.
See the entry for set for the remaining options.
Arguments are assigned in order to the positional
parameters $1
, $2
, etc. If the first argument is a script,
commands are read from it, and the remaining arguments are assigned to
$1
, $2
, etc. The name of the script is available
as $0
. The script file itself need
not be executable, but it must be readable.
3.17.6.75