Hello, i have a script which checks if the user entered 8 numeric characters in the form of YYYYMMDD (birth date). If the user entered any non numeric characters, an error will be displayed:
Code:
# Check to see if the 8 characters are all numbers
# If not show error essage
# And prompt user for more input
echo $char | grep -q '^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$'
if [ $? -ne 0 ]
then
echo "You have entered non-numeric values. Please type in the form of YYYYMMDD"
read char
continue
Is there a simpler way to write this command without using the [0-9] value for each field? Any help would be appreciated