[Linux-cluster] GNU date on RHES 4.x
Hugo Lombard
hal at elizium.za.net
Sun Jan 30 05:13:58 UTC 2011
On Sun, Jan 30, 2011 at 12:15:25PM +0800, sunhux G wrote:
> I'm trying to get yesterday's date in YYYYMMDD format.
> Anyone know if RHES 4.x has GNU date that allows
> yesterday=$(date -d "-1 day" '+%Y%m%d')
>
Does this help?
$ yesterday=$(date -d "-1 day" '+%Y%m%d')
$ echo $yesterday
20110129
$ date
Sun Jan 30 07:10:59 SAST 2011
$ cat /etc/issue
CentOS release 4.8 (Final)
Kernel \r on an \m
$ date --version
date (coreutils) 5.2.1
Written by David MacKenzie.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ which date
/bin/date
$ rpm -qf /bin/date
coreutils-5.2.1-36.el4.centos
$
--
Hugo Lombard
More information about the Linux-cluster
mailing list