#!/bin/bash while : ; do read -p "do you continue(y/n):" k case $k in y ) read -p "u input the number:" n if [ $n -lt 6 ] then m=`seq $n 5` echo $m elif [ $n -gt 5 ] && [ $n -lt 16 ] then m1=`seq $n 15` echo $m1 fi continue ;; n ) exit ;; * ) echo "你输入错误,请重新输入" ;; esac done fi
#!/bin/bash kl(){ read -p "input a pause num:" i read -p "input a pause num:" xi for((i=$i;i<=$xi;i++)) do echo -e "$i \c" done echo } while : do read -p "continue?(y|n)" yes if [ "$yes" = "y" ] then kl else exit 1 fi done
转载于:https://blog.51cto.com/wsw26/1755272