Solved

Get The date of Yesterday in Bash Shell on Solaris8

Posted on 2004-09-29
4
803 Views
Last Modified: 2013-12-26
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
Comment
Question by:A_HASSAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 12186193
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
 

Author Comment

by:A_HASSAN
ID: 12195660
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
 
LVL 38

Accepted Solution

by:
yuzh earned 250 total points
ID: 12196536
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
 
LVL 48

Expert Comment

by:Tintin
ID: 12198431
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
set up trigger (or something) to rename files (starting with ATL) in a linux directory 6 56
iSeries DB2 Query 2 98
viewing source code from eclipse 13 110
wordmultiple challenge 12 157
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question