shell - Getting previous day's date in Unix -
i using following code assign previous day's date variable yesterday:
yesterday=`tz=gmt+24 date +%y%m%d`; echo $yesterday;
the value assigned correctly when execute command during morning hours. during night hours (around 9 pm), not getting previous day date, same date today.
my server located in pdt timezeone. tried "tz=pdt+24" assigning, got same result.
fyi, using solaris 5.10.
what can reason bizarre situation?
i cannot exact test on solaris. on linux works getting last day(yesterday):
kent$ date -d'yesterday' +%y%m%d 20130520
so type "yesterday", don't have special date
. cool, isn't it?
Comments
Post a Comment