OnCallReady

Commands

bash - GNU Bourne-Again SHell

bash [options] [command_string | file]

Options you will use

-c string
Read and execute commands from string, then exit.
-n
Read commands but do not execute them. Syntax check only.
-x
Print each command and its expanded arguments to stderr before running it (xtrace).
-e
Exit immediately if a command exits non-zero. See the gotchas in NOTES.
-u
Treat unset variables as an error when substituting.
-o pipefail
A pipeline returns the status of the rightmost command that failed.
-s
Read commands from standard input.
--noprofile
Do not read /etc/profile or ~/.bash_profile (login start files).
--norc
Do not read ~/.bashrc.

Examples

$ bash -n script.sh

syntax-check a script without running it

$ bash -x script.sh

trace every command as it runs

$ bash -c 'echo $BASH_VERSION'

run one command string

Gotchas

Taught in

Try bash in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.