123213 发表于 2015-11-23 09:34:04

shell判断用户输入是否是数字

#!/bin/bash
while :
do
    read -p "Please input a number: " n
    n1=`echo $n|sed 's///g'`
    if [ -z $n1 ]
    then
      echo $n
      exit 0
    else
      continue
    fi
done

页: [1]
查看完整版本: shell判断用户输入是否是数字