[TriLUG] OT: bash scripting question

Greg Brown gregbrown at mindspring.com
Wed Jun 25 09:00:37 EDT 2003


I need an easy way to figure out the date for "yesterday" in a script.  
This is easy enough to do with Perl but I can't use Perl for this 
script.

To get the seconds from Jan 1, 1970 I use the following command:

date +%s

I can then do some math to the output (subtracting (24 * 60 * 60)) to 
return yesterday's date but is there an easy way to translate the 
corresponding string of seconds back to a human readable date?  The 
date command doesn't seen to do this for me, at least not that I can 
see.

Greg




More information about the TriLUG mailing list