Getting week in month.???

Hi All,

I have a tricky problem. I need to write a shell script (bash) which identifies which week off the month it is. I need to create a partition each week. So for the first week (where first of the week is Monday) of March i want to create partition_march_01 and for the second partition partition_march_02 etc.

I also need to get the exact date into a variable which I can use an marker.

I have been looking at date and +%w which will give me the first day of the week, and +%W which will get me the number of week in the year. Is there a straight forward command I've missed that will tell me that its week 3 of May?

Thanking you all inadvance,

:confused:

#!/bin/ksh

date='18'

cal | nawk -v date="${date}" '
           FNR > 2 { for( i=1; i <= NF ; i++ ) if ($i==date) { print FNR-2; exit} }'