Any one help me how to check the day ocuurence in a month in shell script
Example :
the day is monday means where this monday is first monday or second one
Printable View
Any one help me how to check the day ocuurence in a month in shell script
Example :
the day is monday means where this monday is first monday or second one
I thought I responded about a week ago, still don't see it
try something along the lines of
depending on what you are looking for this should give a starting pointQuote:
DayOfMonth=$(date +%d)
DayOfWeek=$(date +%a) ## returns Sun,Mon......
if [ $DayOfWeek == "Mon" ] ; then
echo " ok Its a Monday"
if [ $DayOfMonth -le 7] ; then
echo " Must be first Monday of month"
elif [ $DayofMonth -le 14 ] ; then
echo " Must be second Monday of Month"
fi
else
echo " Not a Monday its $DayOfWeek "
fi