Cal command

I am trying to configure the cal command to recognize the month names.
When you type: cal - you get the calander for the current month of the current year.

Is there a way of making the system recognize March, and Mar. So I could type:

cal March or cal mar and get the same response as cal.
I ws thinking on how to do this but I'm thinking it might not be able to be done.

Thanks,

theA

# cal 3 2001

______March 2001
Su Mo Tu We Th Fr Sa
____________01 02 03
04 05 06 07 08 09 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31   

where 3 is the month.

added code tags for readability --oombera

Neo,
I know that much, but
I meant so I could type cal mar, or cal March.
Any suggestions.

Thanks,

theA

The cal command accepts numbers for months versus names. If you want otherwise you might consider writing a wrapper script that takes the different text inputs for months, maps the text forms (mar, March, Mar, march, etc.) to the number (in this case 3) and sends it to the cal utility.

This wrapper script could be written in a few minutes, don't you think?

Neo,
I am not familar with wrapper scripts.
I was thinking a longer way of doing things would be do write a bunch of if, elifs and write something like if
if [ "$1" -eq January ]
then
cal 1 2001
fi

for getting january 2001, then fill in the rest through to december.
What do you say is this an effective way or, should I try something else.

Thanks again,

theA

Yes, what you are describing is a 'wrapper script' because you are wrapping script around the command(s) (in this case the cal command) to perform differently than without the wrapper. So, you are on the right track. Remember to have statements or switches "Jan" and "jan" and "January" etc. based on your project needs. Also, when you write a wrapper, if others will be using it, you might consider writing a quick man page and/or a command line help file.