last month's logfile

hi friends
I need a shell script which will do the following Task

Enter the month :
if you enter 1 then it ll show you last 1 month's (starting from today).log file in the current directry.
if you enter 4 then it ll show you last 4 month's (starting from today).log file in the current directry
like wise for n .....

Thanks in advance!!

Something like this?

echo "how many months back "
read month


while [ ${month} -ne 1 ]; do
        let month=month-1
        cat "$month".log
done

Dear Deep_kol,

Have you tried anything on your own ?? Could you show it to us so that we can check it and suggest further steps ?

Mr. Earnstaf - Have a close look at his requirement, its not so simple :slight_smile: