Dear pal,
I want to read only numbers thru a shell script,
If user is trying to enter character it should block that ...
Pls help to me find out a solution
Dear pal,
I want to read only numbers thru a shell script,
If user is trying to enter character it should block that ...
Pls help to me find out a solution
example code snippet:
# x="q"; while [ `echo $x | grep "[^0-9]"` ]; do read x; done
hello
123g
12
# echo $x
12
read integer 2>/dev/null
until [[ $integer = +([0-9]) ]]
do
read integer 2>/dev/null
done