Hi,
Help needed abt validation. I need to validate the user-input.
I require the user should input as mm/dd/yy. So he should be able to enter in this format only. So until he enters in this format i should not allow him to enter any other values. And I need to check he enters only numbers
for mm,dd,yy.
I tried like this, but didnt work out properly. Is this rite way ? Am pretty new to Unix.
echo "enter date in mm/dd/yy "
read sdt
if [ $sdt != [0-9][0-9]/[0-9][0-9]/[0-9][0-9] ]
then
echo "enter again"
exit 1
fi
Thanks in Advance.
Help needed abt validation. I need to validate the user-input.
I require the user should input as mm/dd/yy. So he should be able to enter in this format only. So until he enters in this format i should not allow him to enter any other values. And I need to check he enters only numbers
for mm,dd,yy.
I tried like this, but didnt work out properly. Is this rite way ? Am pretty new to Unix.
echo "enter date in mm/dd/yy "
read sdt
if [ $sdt != [0-9][0-9]/[0-9][0-9]/[0-9][0-9] ]
then
echo "enter again"
exit 1
fi
Thanks in Advance.