I'm trying to do validation of a date entered as numbers only. (e.g. 09042009 as 09/04/2009) The code now just checks the length of the date.
How would I validate not only length of the date entry but also that it is a real date? What would be the syntax for combining tests and regular expression?
Code as it exists now:
echo "Please enter the date you want (e.g. 07142009)"
level=1;
while [ $level -gt 0 ]; do
read date;
dateleng=`expr length $date`
if [ dateleng -ne 8 ]; then
echo "Bad date, please re-enter";
else level=0;
fi
done
This is in KSH on an old Unix system.