Skip to content

Instantly share code, notes, and snippets.

@greymd
Last active January 12, 2017 13:50
Show Gist options
  • Select an option

  • Save greymd/7ff39c2f84b0a0a02fdec8e12fcff502 to your computer and use it in GitHub Desktop.

Select an option

Save greymd/7ff39c2f84b0a0a02fdec8e12fcff502 to your computer and use it in GitHub Desktop.
mapfile練習のfizzbuzz
$ echo {'yes " " | (',"mapfile -tc "{'3 -C "echo fizz"','5 -C "echo buzz"','1 -C "echo @"'}" -n100 -O 1;",')'} | \
bash | sort -k2,2n | awk '{a[$NF]=$1""a[$NF]}END{for (k in a){print k,a[k]}}' | tr -d '@'
$ :() { bc <<<"print $1%3;$1%5" | tr -d '[1-9]' | sed 's/0/Fizz/;s/0/Buzz/'; }; mapfile -n 100 -O 1 -c 1 -C ':' < <(yes) | nl -ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment