I just found the following FizzBuzz example on Hacker News and it uses a piece of syntax I'm finding it difficult to search for
for num in {1..100} ; do
out=""
(( $num % 3 == 0 )) && out="Fizz"
(( $num % 5 == 0 )) && out="${out}Buzz"
echo ${out:-$num}
done
The bit I don't understand is how the variable usage works in the echo
line. Though I can obviously see that it becomes $out
if not empty, else $num