Easy Number Checks
Number checks are too long.
1if [ "$x" -gt "$y" ]; then
2 echo "$x"
3else
4 echo "$y"
5fi
Write a shorter number check like this:
echo $(( x > y ? x : y ))
Longer checks are possible:
1col(){
2 n=$(( $1 % 2 == 0 ? $1 /2 : $1 * 3 + 1 ))
3 echo $n
4 [ $n -eq 1 ] || col $n
5}
6
7col 4
8col 5
9col 9
10col 27