I am trying to validate user's input So input is a number not a string or null. using case I tried to do this
echo "input a number"
read num1
case $num1 in
"" |*[a-zA-Z]*)
echo "please inter a valid number"
esac
echo "input 2nd number"
read num2
let sum=$num1+$num2
echo "$num1 + $num2=$sum"
But it didn't quite work. It gives me the warning about the input though -- And is there away to validate both variables at the sametime?
case
– amisax Jul 07 '17 at 04:15