Unix

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • SUMMARY: KSH day of week script in past

    0 answers - 1076 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    The answer was to use gnu date like so:
    #DAY=`/usr/local/bin/date -d 07/11/05 +%a`
    # echo $DAY
    Mon
    also someone was nice enuf to give me this ksh function:
    dow() { # year month day
    week=`cal "${2}" "${1}" | grep -w "${3}"`
    sun=`echo "${week}" | cut -c 01-02`
    mon=`echo "${week}" | cut -c 04-05`
    tue=`echo "${week}" | cut -c 07-08`
    wed=`echo "${week}" | cut -c 10-11`
    thu=`echo "${week}" | cut -c 13-14`
    fri=`echo "${week}" | cut -c 16-17`
    sat=`echo "${week}" | cut -c 19-20`
    if [ "${3}" -eq "${sun}" ]; then echo Sun; fi
    if [ "${3}" -eq "${mon}" ]; then echo Mon; fi
    if [ "${3}" -eq "${tue}" ]; then echo Tue; fi
    if [ "${3}" -eq "${wed}" ]; then echo Wed; fi
    if [ "${3}" -eq "${thu}" ]; then echo Thu; fi
    if [ "${3}" -eq "${fri}" ]; then echo Fri; fi
    if [ "${3}" -eq "${sat}" ]; then echo Sat; fi
    }
    dow 2004 12 31
    Is your PC infected? Get a FREE online computer virus scan from McAfee.
    Security.
    sunmanagers mailing list
    sunmanagers (AT) sunmanagers (DOT) org

Re: SUMMARY: KSH day of week script in past


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "Unix"

EMSDN.COM