zsh recursive glob and batch rename bash
zsh: list only regular files recursively, then mass-rename safely with zmv
setopt extendedglob; print -l **/*(.); autoload zmv; zmv '(*).txt' '$1.bak'
more bash
all 12 commands →
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)
Read file lines into array safely
mapfile -t lines < file.txt; printf '%s\n' "${lines[@]}"
Parameter expansion toolkit
f=/var/log/app.log.gz; echo "${f##*/}" "${f%.*}" "${f//log/LOG}"