- Reference
- Cheat Sheet by devhints
- Lint with shellcheck:
find . -name '*.sh' -print0 | xargs -0 shellcheck -s bash
#!/usr/bin/env bash
set -euo pipefail
- See also: redsymbol, disconnected.
LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 64
shared_args=(
--some "$value_with_spaces"
"$etc"
)
if condition
then shared_args+=(--more)
fi
command1 --args1 "${shared_args[@]}"
command2 --args2 "${shared_args[@]}"
A=""
if [ -n "$A"]
then echo "not empty"
else echo "empty"
fi
- Detected with shellcheck.