📜  bash if is number - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:46.234000             🧑  作者: Mango

代码示例2
re='^[0-9]+$'
if ! [[ $yournumber =~ $re ]] ; then
   echo "error: Not a number" >&2; exit 1
fi