• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

Get The date of Yesterday in Bash Shell on Solaris8

Dear All,
    Can anyone guide me how to get the date of Yesterday in the Bash shell in Solaris 8.
    Is using the normal date command would get the date of Yesterday by any means?
0
A_HASSAN
Asked:
A_HASSAN
  • 2
1 Solution
 
yuzhCommented:
You can do:

yesterday=`TZ=$TZ+24 date +%m%d%Y%H%M%S`
echo yesterday

PS: you can format the output the way you wanted as the "date" command

eg:

yesterday=`TZ=$TZ+24 date `
echo yesterday

output format as the same as date command.
0
 
A_HASSANAuthor Commented:
I am really thankfull for you reply I would try it today, but I would like to ask about the following possiubility:
  I have a file which has been created let us say on 27th Sept. 2004, and it has been closed on 28th Sept. 2004, if I make "ls -alt" to such file -let us say on the 30th Sept. 2004 I get athe date 28th Sept. 2004, is there a way to get the date where the file was first created, or if there is an alternative command that when I get the of closing the file I can subtract one day back to get the day of its creation?
     Thanks in advance.
0
 
yuzhCommented:
Solaris "ls" give you the last modified time,it is  not easy to get the creation time. the
close you can get is to use "find" command, see http:Q_20670315.html
0
 
TintinCommented:
Remember that on Unix systems, the creation date is not stored anywhere, so you can make assumptions about what might be the actual creation date depending on your circumstances.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now