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 ~_~

I just wrote this program myself in bash. I created an array
CALENDER=(31 28 31 30 31 30 31 31 30 31 30 31)

Dealing with leap year is the trick part. If you want let me now and I'll supply my script.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.