1、根据用户输入,判断是数字、字母或其他字符。
#!/bin/bash
#########################
#File name:input.sh
#Version:v1.0
#Email:admin@test.com
#Created time:2022-08-29 17:46:19
#Description:
#########################
read -p "please enter a character ,press enter to continue:" str
if echo "$str"|grep "[a-zA-Z]" >/dev/null
then
echo "input is letter"
elif echo "$str"|grep "[0-9]" >/dev/null
then
echo "input is number"
else
echo "input is other"
fi
结果: