HP3000-L Archives

August 1998, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Andreas Schmidt <[log in to unmask]>
Reply To:
Date:
Wed, 5 Aug 1998 10:50:17 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (117 lines)
---------------------- Forwarded by Andreas Schmidt/HI/CSC on 08/05/98 10:47 AM
---------------------------


Andreas Schmidt
08/05/98 10:49 AM

To:   [log in to unmask]
cc:
Subject:  Re: shell scripts for date calcs  (Document link not converted)

s.th. like this (not finished but may give you an idea ...):

YEAR=`date "+%Y"`
MONTH=`date "+%m"`
DAY=`date "+%d"`
let DAY_5=$DAY-5
case $DAY_5 in
        0) case $MONTH in
                01) let MONTH_5=12
                    let DAY_5=31
                    let YEAR_5=$YEAR-1
                    ;;
                02) let MONTH_5=01
                    let DAY_5=31
                    let YEAR_5=$YEAR
                    ;;
                03) let MONTH_5=02
                    let DAY_5=28
                    let YEAR_5=$YEAR
                    ;;
     04)
        ;;
     05)
        ;;
     06)
        ;;
     07)
        ;;
                08) let MONTH_5=07
                    let DAY_5=31
                    let YEAR_5=$YEAR
                    ;;
     09)
        ;;
     10)
        ;;
     11)
        ;;
     12)
        ;;
           esac
        ;;
       -1) case $MONTH in
     *)
     ;;
     esac
      -2)
     ;;
     -3)
     ;;
     -4)
     ;;
   -5)
     ;;
    *) let MONTH_5=$MONTH
        let YEAR_5=$YEAR
        ;;
esac

echo $YEAR_5" / "$MONTH_5" / "$DAY_5

script was tested on sh.hpbin and on HP-UX and on AIX for today ...

not covered: leap years.

Will become very longish ... very boxed ("verschachtelt" in German ...) but
primitive ....

Best regards, Andreas Schmidt, CSC, Germany




[log in to unmask] on 08/04/98 02:10:00 PM

Please respond to [log in to unmask]

To:   [log in to unmask]
cc:    (bcc: Andreas Schmidt/HI/CSC)
Subject:  shell scripts for date calcs




Greg Stigers wrote:
Here's a challenge: I was asked how to calculate the date five days from
now in the shell from the command line, without using awk or perl. Sorry
to bring this up, since we just visited CI date routines...
-------------------------Reply Separator--------------------
There is an MPE/iX command file named "TODAY" at
http://www.denkor.com/hp3000/command_files/samples.html that will do this.
Load the command file into PUB.SYS and use the "callci" shell command to xeq
it from the shell prompt (callci "today 5").  Use the "env" shell command to
display the resulting date varibles.
Steve Barrett
    Steven P. Barrett    [log in to unmask]
    Systems Analyst
    Fairfax County Public Library     (703) 222-3132 - Voice
    Technical Operations Center       (703) 222-3135 - FAX
    4000 Stringfellow Rd.
    Chantilly, VA  20151
    --- The opinions expressed here are mine alone . ---
    If God had meant for us to have distributed systems, he
    would have put little brains in our hands and in our
    fingers.  (Unknown Author)

ATOM RSS1 RSS2