Skip to content

Instantly share code, notes, and snippets.

@d-shimizu
Last active September 21, 2018 02:56
Show Gist options
  • Save d-shimizu/5019574 to your computer and use it in GitHub Desktop.
Save d-shimizu/5019574 to your computer and use it in GitHub Desktop.
シェルスクリプトでFizzBuzzワンライナー ref: https://qiita.com/d_shimizu/items/dfd5d521e2c2a5fe5e4e
$ jot 100 | awk '$1%3==0&&$1%15!=0{print "Fizz"} $1%5==0&&$1%15!=0{print "Buzz"} $1%15==0 {print "FizzBuzz"} $1%3!=0&&$1%5!=0{print $1 }' | tr ' ' '\n'
$ seq 1 100 | awk '$1 %3 == 0 && $1 %15 != 0 {print "Fizz"} $1 %5 == 0 && $1 %15 != 0 { print "Buzz"} $1 %15 == 0 {print "FizzBuzz"} $1 %3 != 0 && $1 %5 != 0 { print $1 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment