Found two nice shell scripting idioms recently. Variables and default values, by [1]: 1 : "${m:=12}" Which is a short version of this: 1 [[ -z "$m" ]] && m=12 Using a free fd to read from in while loops, which leaves the original STDIN untouched, by [2]: 1 while read -r <&3 2 do 3 ... whatever ... 4 done 3