Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display the day prior to the current DOW.

Status
Not open for further replies.

kozlow

MIS
Mar 3, 2003
326
US
I have logs that have the current DOW at the end. I used `date +%a`

for example TEST.log.Tue

Is there a simple way to use the date command to return the prior DOW? Example: If it is Wed, I would like to work on Tue log.

I know I can use a case statement, but that there has to be an one line way.....

Thanks....
 
The way we do it is to write a text file using cron containing the date in the format we require at (say) 23:59 on the day before and then reference that file to rename logs as required.

All I ask of you
Is make my wildest dreams come true
 
echo `(export TZ=XYZ+24; date "+%a")`

will show the previous day

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top