Bash
getopts in Bash: Parse Command-Line Options Properly
A tested getopts skeleton for Bash scripts: flags, options with values, required options, error handling, and a manual loop for --long options.
Topic
A tested getopts skeleton for Bash scripts: flags, options with values, required options, error handling, and a manual loop for --long options.
set -euo pipefail is good advice, but each option has rules about when it fires. Here is what each one does and the cases that surprise people.