Return to BSD News archive
Xref: sserve comp.unix.bsd:14580 comp.unix.misc:13499 comp.unix.programmer:19256 comp.unix.questions:53642 Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!cs.utexas.edu!convex!not-for-mail From: grefen@convex.com (Stefan Grefen) Newsgroups: comp.unix.bsd,comp.unix.misc,comp.unix.programmer,comp.unix.questions Subject: Re: Q: How can I get yesterday's date? Date: 16 Aug 1994 09:32:50 -0500 Organization: Engineering, Convex Computer Corporation, Richardson, Tx USA Lines: 38 Message-ID: <32qimi$hdt@hydra.convex.com> References: <Pine.3.89.9408160216.A15886-0100000@worf.uwsp.edu> NNTP-Posting-Host: hydra.convex.com In article <Pine.3.89.9408160216.A15886-0100000@worf.uwsp.edu>, Peter Zuge <pzuge@worf.uwsp.edu> wrote: >I am using BSD/386 unix: > >I need to create a script that will run at a certain time everyday >"getting" ( via ftp ) a file with yesterday's date. > >I have the script working except for one detail; "getting" the file using >the actual name. The name of the file uses the date for its name >( format: GS940815.LOG or "GS" + yy + mm + dd + ".LOG" ). > >Question: How can I get the date just previous to today, and put it into > the correct format I need? date -r `expr \`date +%s\` - 86400` should work (may be with an intermediate stage to avoid quoting problems). Look at the formatting capabilities of date (like strftime) to build your filename. Stefan > >Many Thanks in Advance. > <<<< > o(0-0)o > ------------------ooO-(_)-Ooo------------ > Peter A. Zuge Gopher Administrator > U of Wisconsin, Stevens Point > Information Technology > ----------------------------------------- > Gopher: gopher.uwsp.edu > e-mail: pzuge@worf.uwsp.edu > -- Stefan Grefen Convex Computer GmbH, Frankfurt, Germany grefen@convex.com Phone: +49-69-665270