Bound command with timeout and kill bash
SIGTERM at 30s then SIGKILL after 5s grace; exit 124 means it was killed
timeout -k 5s 30s ./long_task.sh || echo "timed out: $?"
more bash
all 12 commands →
Dedicated fd for structured logging
exec 3>>audit.log; echo "$(date -Is) start" >&3; exec 3>&-
zsh recursive glob and batch rename
setopt extendedglob; print -l **/*(.); autoload zmv; zmv '(*).txt' '$1.bak'
Strict mode with safe IFS
set -euo pipefail; IFS=$'\n\t'
Cleanup temp dir via trap
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT INT TERM
Diff two command outputs
diff <(kubectl get cm a -o yaml) <(kubectl get cm b -o yaml)