Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script using cal that accepts from command line

Status
Not open for further replies.

ephemeralz

Programmer
Dec 10, 2003
3
US
I want to create a script that can accepts more than one month name on the command line, as in "mycal jan feb" and also accept ranges of months like "mycal jan - mar" or also "mycal jan - mar 2004 apr 2003"

Thanks for the help
 
'wanting' is good beginning.
what do you have so far?

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I already have a program 'name2num' that converts the months to a number. e.g. jan = 1, mar = 3, etc.. I'm new to shell scripting and below is what I have so far:

if [ $# = 0 ] ; then
echo &quot;usage: $0 month ..&quot;
exit
fi
MONTH = &quot;&quot;
DASH = FALSE

for m in $*
do
ARG=`name2num $m`
echo $ARG
if test $m = -
then
DASH=TRUE
elif test $ARG != error && DASH == TRUE

MONTH = &quot;$MONTH $ARG&quot;
fi


done

I would like to store the month &quot;jan - jun&quot; to a variable.
The $MONTH would have 1 2 3 4 5 6

Thanks.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top