Just fixed a syntax error by replacing this:
if k < 25 then
# ...
else if k < 40 and arg == 0 then
# ...
else
# ...
end
With this:
if k < 25 then
# ...
else
if k < 40 and arg == 0 then
# ...
else
# ...
end
end
Yow! Bash definitely gets that right with elif. And also case.
I don't know if case or match or cond is better, but I fervently believe that elif needs to be added. Wow, is it painful to statically nest if/else blocks!