Hi, I am creating a program that will validate if the user input date is correct.
My problem is checking the month,
1. Is it possible to save the all the months in an array and then check the array if the user input is correct.
2. How can it be possible?
Sorry I am new to shell scripting thats why I have so many questions.
Thanks in advance..
echo -n " Date [ DD-MON-YY ]:" #user will input the date
read date1 mon1 yy1
datefn # call the function to check the input
datefn(a, b, c){
########## check the DAY #####################
if [ "$a" -gt 0 ] && [ "$a" -le 31 ]
then
break ;;
else
echo "Month is OUT OF RANGE!"
fi
########## check the MONTH #####################
1 = Jan
2 = Feb
3 = Mar
4 = Apr
5 = May
6 = Jun
7 = Jul
8 = Aug
9 = Sep
10 = Oct
11 = Nov
12 = Dec
if [ $b ==
}
I dont know what to do next ~_~