judge input type
#! /bin/bash
while true;do
read -p "please input:" a
expr $a + 1 &> /dev/null
if [ $? -eq 0 ] ;then
echo "input is int."
else
echo "input is char."
fi
if [ $a == 'q' ];then
break
fi
done
#! /bin/bash
while true;do
read -p "please input:" a
expr $a + 1 &> /dev/null
if [ $? -eq 0 ] ;then
echo "input is int."
else
echo "input is char."
fi
if [ $a == 'q' ];then
break
fi
done