Created
July 10, 2019 15:06
-
-
Save johnxx/1c795b6788c1f683c72adf5288a74b98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for n in {1..100} ; do | |
output='' | |
expr $n % 3 > /dev/null || output='fizz' | |
expr $n % 5 > /dev/null || output=$output'buzz' | |
[ -z $output ] && output=$n | |
echo $output | |
done | |
if [ -z $1 ] ; then | |
echo {1..100} | parallel -d' ' -k -m -j100 $0 {} | |
else | |
output='' | |
[ $(( $1 % 3 )) -eq 0 ] && output='fizz' | |
[ $(( $1 % 5 )) -eq 0 ] && output=$output'buzz' | |
[ -z $output ] && output=$1 | |
echo $output | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment