[ale] Linux shell process
Lightner, Jeff
JLightner at water.com
Mon Mar 19 15:34:04 EDT 2012
Unfortunately that works with the GNU date but not with proprietary implementations.
-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of Michael H. Warfield
Sent: Monday, March 19, 2012 3:10 PM
To: Atlanta Linux Enthusiasts
Cc: mhw at wittsend.com
Subject: Re: [ale] Linux shell process
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!
Athena(r), Created for the Cause(tm)
Making a Difference in the Fight Against Breast Cancer
---------------------------------
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
----------------------------------
More information about the Ale
mailing list