清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/bin/bash ## Author : TaxKiz ## Email : taxkiz@gmail.com export PATH='/bin:/sbin:/usr/bin:/usr/sbin' ## NUM='3 5 7' NUM=$* ## 检查输入的数字个数是否为 3 个 function CT () { [ $# != '3' ] && echo " Please Enter 3 Number ! " && exit 1 } CT $NUM ## 个位数列表 NT='1/2/3/4/5/6/7/8/9' ## 检查输入的数字是否为个位数 function CK () { for num in $* do [ $num == '0' ] && echo "Error Number '$num'" && exit 2 echo $NT | grep "\b$num\b" > /dev/null 2>&1 [ $? != '0' ] && echo "$num is not a single digit" && exit 3 done } CK $NUM ## 判断是否有重复的数字 function SN () { if [ $1 == $2 ] || [ $1 == $3 ] || [ $2 == $3 ]; then echo "ERROR! There have same number : '$*'" exit 4 fi } SN $NUM ## 大喊一声 function GO () { A1=$1 A2=$2 A3=$3 T1=$(( $1 * $2 )) T2=$(( $1 * $3 )) T3=$(( $2 * $3 )) TA=$(( $1 * $2 * $3 )) for num in {1..100} do echo $num | grep $A1 > /dev/null 2>&1 [ $? == '0' ] && echo 'Fizz' && continue echo "scale=2; $num/$TA" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'FizzBuzzWhizz' && continue echo "scale=2; $num/$T1" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'FizzBuzz' && continue echo "scale=2; $num/$T2" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'BuzzWhizz' && continue echo "scale=2; $num/$T3" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'FizzWhizz' && continue echo "scale=2; $num/$A1" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'Fizz' && continue echo "scale=2; $num/$A2" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'Buzz' && continue echo "scale=2; $num/$A3" | bc | grep 00 > /dev/null 2>&1 [ $? == '0' ] && echo 'Whizz' && continue echo $num done } GO $NUM