Invoking the Shell
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.
Options
-cstrRead commands from string str.
-D,--dump-stringsPrint all
$"…"strings in the program.-iCreate an interactive shell (prompt for input).
-l,--loginShell is a login shell.
-OoptionEnable shopt option option. Use
+Oto unset option.-pStart up as a privileged user. Do not read
$ENVor$BASH_ENV; do not import functions from the environment; and ignore the values of theBASHOPTS,CDPATH,GLOBIGNORE, andSHELLOPTSvariables. The normal fixed-name startup files (such as $HOME/.bash_profile) are read.-r,--restrictedCreate a restricted shell.
-sRead commands from standard input. Output from built-in commands goes to file descriptor 1; all other shell output goes to file descriptor 2.
--debuggerRead the debugging profile at startup and turn on the
extdebugoption to shopt. For use by the Bash debugger (see http://bashdb.sourceforge.net). ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access