#!/bin/bash while : do read -p "please input a number: " n m=`echo $n|sed ‘s/[0-9]//g‘` if [ -z $m ] then echo $n exit fi done
#while死循环,直到输入正确数字退出
时间: 2024-10-20 17:48:16
#!/bin/bash while : do read -p "please input a number: " n m=`echo $n|sed ‘s/[0-9]//g‘` if [ -z $m ] then echo $n exit fi done
#while死循环,直到输入正确数字退出