Back to the command reference

bash

ShellFundamentals In simulator In real Linux

The Bash shell; also runs scripts

Name: bash = Bourne-Again SHell (a pun on the Bourne shell)

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

bash is the GNU project's shell and the default on most Linux distributions. It is compatible with the classic Bourne shell (sh) and adds history, Tab completion, arrays, [[ ]] and more.

It is both the interactive environment you type into and the interpreter that runs shell scripts.

Syntax

bash [OPTION]... [FILE]

Common options

-cRun a command string
-xPrint each command as it runs (debugging)
-nCheck syntax without running
-eStop at the first failing command (set -e in scripts)
-uAn unset variable is an error
-o pipefailA pipeline fails if any command in it fails
-vPrint each line as it is read (for debugging)
-l / --loginStart as a login shell (reads /etc/profile and ~/.bash_profile)
--norcDo not read ~/.bashrc

Examples

Related