Counters for instant steps (a bar over four symlinks is animation over
nothing); the tool’s native progress for slow ones (git --progress,
curl -#), which already knows totals and ETA. TTY only, piped output clean.
TOTAL=3 N=0 # keep TOTAL equal to the number of stepsstep() { N=$((N + 1)); ok "[$N/$TOTAL] $1"; }
# single-line ticker for loops over many items; cleans up after itselftick() { [ -t 1 ] && printf "\r %2d/%d %s\033[K" "$1" "$2" "$3" || true; }tickend() { [ -t 1 ] && printf '\r\033[K' || true; }
# curl: progress bar on a TTY, silent when piped (stderr carries the bar)if [ -t 2 ]; then CURL="curl -f#L"; else CURL="curl -fsSL"; fi