Semi-OT: Why Kids Can't use Computers
Kevin Cozens
kevin-4dS5u2o1hCn3fQ9qLvQP4Q at public.gmane.org
Thu Aug 15 22:50:14 UTC 2013
On 13-08-15 03:32 PM, Walter Dnes wrote:
> #!/bin/bash
> for counter in {1..100}
> do
> if [ $(( ${counter} % 15 )) -eq 0 ]; then echo "Fizz-Buzz"
> elif [ $(( ${counter} % 3 )) -eq 0 ]; then echo "Fizz"
> elif [ $(( ${counter} % 5 )) -eq 0 ]; then echo "Buzz"
> else echo ${counter}
> fi
> done
Do you lose points for typos? (Fizz-Buzz instead of FizzBuzz) :)
Under Linux Mint 14 which uses dash (instead of bash) as default kernel, the
example program doesn't run.
sh fizzbuzz.sh
fizzbuzz.sh: 4: fizzbuzz.sh: arithmetic expression: expecting primary: "
{1..100} % 15 "
--
Cheers!
Kevin.
http://www.ve3syb.ca/ |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172 | the mouth-breathers, and that's why we're
| powerful!"
#include <disclaimer/favourite> | --Chris Hardwick
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list