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<data
____________________
1.
https://github.com/c00kiemon5ter/iii/blob/36728389151c7ce558b5acb61b64597662c6f018/iii.sh#L9
2.
https://github.com/s-p-k/foxy/blob/08225ca788e16568885d82cd43383970b5589648/foxy#L116