Bash scripting¶
Turning command sequences into scripts: output and input, variables, conditions, loops and functions, plus the tools that make scripts robust and safe to run unattended.
Basics: How a script is built: shebang, quoting, variables, arguments and exit codes
Output and input¶
Variables and environment¶
Conditions¶
Loops¶
Functions and exit codes¶
Robust scripts¶
-
Stop on errors, debug scripts.
-
Clean up on exit and signals.
-
Read options like
-vand-t. -
Find mistakes before the script runs.