Path: utzoo!attcan!uunet!dasys1!jpr From: jpr@dasys1.UUCP (Jean-Pierre Radley) Newsgroups: comp.unix.questions Subject: Re: "yesterdate" function? Keywords: Date Calcualtions Message-ID: <8268@dasys1.UUCP> Date: 13 Jan 89 22:20:23 GMT References: <19100001@hpficad.HP.COM> Reply-To: jpr@dasys1.UUCP (Jean-Pierre Radley) Organization: TANGENT Lines: 21 In article <19100001@hpficad.HP.COM> mcr@hpficad.HP.COM (Matt Reprogle) writes: >I need a way to get yesterday's date in YYMMDD format in a Unix script and put >it in a file. I don't want to write a C program implementing an entire >calendar to do it. The C program exists: "datecalc", written by Fred Buck, and available in the LIBraries of the TANGENT Forum on Compuserve. It'll solve that problem, and do dozens of other little date routines. Anyone not on CIS, E-mail me. But to just solve the one little problem posed by Matt: GMTDIFF=`echo $TZ | sed 's/[^0-9]*//g'` YESTGMTDIFF=`expr $GMTDIFF + 24` TZY=`echo $TZ | sed 's/[0-9][0-9]*/'$YESTGMTDIFF'/'` YESTERDATE=`TZ=$TZY date +%y%m%d` -- Jean-Pierre Radley Honi soit jpr@dasys1.UUCP New York, New York qui mal ...!hombre!jpradley!jpr CIS: 76120,1341 y pense ...!hombre!trigere!jpr