#2
ddppt2023-03-28 13:55
#!/bin/bash
read -p "input a integer:" num
flag=true
while $flag
do
expr $num + 0 &>/dev/null
[ $? -eq 0 ] && flag=false || read -p "please input a integer:" num
done
[[ ${num}%7 -eq 0 && ${num}%3 -ne 0 ]] && b="first"
[[ ${num}%7 -eq 0 && ${num}%3 -eq 0 ]] && b="second"
[[ ${num}%7 -ne 0 && ${num}%3 -eq 0 ]] && b="third"
[[ ${num}%7 -ne 0 && ${num}%3 -ne 0 ]] && b="fourth"
case $b in
first)
echo "第一类"
;;
second)
echo "第二类"
;;
third)
echo "第三类"
;;
fourth)
echo "第四类"
;;
*)
echo "输入有误"
esac
|