FizzBuzz in Bash

I wrote this a few years ago, originally tweeting it (with a since deactivated account). At that time I spent more time playing on the command line than using the GUI.

for i in {1..100};do ((($i%15==0))&& echo FizzBuzz)||((($i%5==0))&& echo Buzz;)||((($i%3==0))&& echo Fizz;)||echo $i;done;

This was a way of getting around the fact Bash has not built-in ternary operator, and was designed to fit into the length of a tweet with a mention or retweet.

The concepts/methods used probably serve no useful purpose in Bash or other programming. But it was a fun exercise at the time.

Update 31 August 2016

Found another version I did at some point last year.

for i in {1..100};do(($i%15))&&((($i%5))&&((($i%3))&&echo $i||echo Fizz)||echo Buzz)||echo FizzBuzz;done;

This version sheds some 17 characters from the length of the original. It also runs quicker.

And through the power of Google, I have found a blog post Bash FizzBuzz where I posted my original as a response. There is also something on StackOverflow and HollenbackDotNet.