Parallel xargs over null-delimited input bash
Run N parallel jobs safely with NUL separators for names with spaces
find . -name '*.log' -print0 | xargs -0 -P"$(nproc)" -n1 gzip
more bash
all 12 commands →
Check PIPESTATUS of each stage
curl -s "$url" | jq .data; echo "${PIPESTATUS[@]}"
getopts flag parsing
while getopts "n:v" o; do case $o in n) ns=$OPTARG;; v) verbose=1;; esac; done
Bound command with timeout and kill
timeout -k 5s 30s ./long_task.sh || echo "timed out: $?"
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'