[ale] Linux shell process

Michael H. Warfield mhw at WittsEnd.com
Mon Mar 19 15:10:14 EDT 2012


On Mon, 2012-03-19 at 16:03 +0000, Lightner, Jeff wrote:
> I use cal to cheat at date math.  With grep and wc you can figure out many things more simply than with more esoteric methods.

For shell scripts, I use "date" for date math.

You gotta really get into the info stuff but the things you can do with
the date --date option are simply amazing...

[mhw at canyon ~]$ date --date=yesterday
Sun Mar 18 15:05:34 EDT 2012
[mhw at canyon ~]$ date --date="today - 1 month"
Sun Feb 19 14:05:41 EST 2012
[mhw at canyon ~]$ date --date="today - 3 weeks"
Mon Feb 27 14:05:51 EST 2012
[mhw at canyon ~]$ date --date="Mon Feb 27 14:05:51 EST 2012 - 3 weeks"
Mon Feb  6 14:05:51 EST 2012
[mhw at canyon ~]$ date --date="Mon Feb 27 14:05:51 EST 2012 - 3 weeks - 6 hours"
Mon Feb  6 08:05:51 EST 2012

It's documented in the info pages for date but not in the man pages (a
little too complex for man, I'm afraid).

Regards,
Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20120319/525e394f/attachment.bin 


More information about the Ale mailing list