bash tricks
#!/usr/bin/env bash set -euo pipefail die() { echo "error: $*" >&2; exit 1; } FOO=foo BAR=bar ARG1="" while [ -n "${1:-}" ]; do case "$1" in -a|--arg1) ARG1=$2; shift;; *) die "Unknown arg: $1";; esac shift done [ -d "$ARG1" ] || die "missing --arg1 or not a directory ($ARG1)" do_something \ --foo "$FOO" `# important because xyzzy` \ "$ARG1" `# note it's classy` do_other | # can do comments after pipe sign! or_another -xyz | # because foobar barfoo