#!/bin/bash
read -p "enter a nunmber :" input
if [[ $input =~ ^[0-9]+$ ]]; then
echo "Input is a number"
else
echo "Input is not a number"
fi
编写一个shell脚本判断用户输入的是否是数字
最新推荐文章于 2024-09-01 10:20:57 发布
#!/bin/bash
read -p "enter a nunmber :" input
if [[ $input =~ ^[0-9]+$ ]]; then
echo "Input is a number"
else
echo "Input is not a number"
fi