Shell script


Results 1 to 2 of 2

Thread: Shell script

  1. #1
    Join Date
    Mar 2013
    Posts
    3

    Shell script

    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

  2. #2
    Join Date
    Oct 2002
    Location
    AZ, USA
    Posts
    110

    Shell script an option

    I thought I responded about a week ago, still don't see it
    try something along the lines of
    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
    depending on what you are looking for this should give a starting point

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •