Bash Scripting
- Strict mode:
set -euo pipefailat the top - Variables: always quote
"$var" - Condition:
if [ -f file ]; then ...; fi - Loop:
for f in *.txt; do echo "$f"; done - Function:
add() { echo $(( $1 + $2 )); } - Args:
$1,$@, count$# - Trap errors:
trap 'echo error at line $LINENO' ERR