The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Collecting & Displaying of Last User ID and Date of Last Login amittal Shell Programming and Scripting 1 03-21-2007 09:18 PM
Collecting & Displaying of Last User ID and Date of Last Login amittal UNIX for Dummies Questions & Answers 1 03-21-2007 10:51 AM
Displaying file names before a particular creation date dhruv_saksena UNIX for Dummies Questions & Answers 1 09-02-2005 05:19 AM
displaying with ls vivekshankar UNIX for Dummies Questions & Answers 2 05-23-2005 12:46 PM
Displaying what a command is doing/has done quantumechanix UNIX for Dummies Questions & Answers 1 07-02-2003 05:40 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-13-2002
minazk
Guest
 

Posts: n/a
displaying date

Hi All,

When I type date..I get the date, time ..etc displayed
...but can someone help me to display yesterdays date... some script to display back dates.

Thanks in advance

Minaz
Reply With Quote
Forum Sponsor
  #2  
Old 11-13-2002
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
See this post for the info you are looking for.
Reply With Quote
  #3  
Old 11-13-2002
minazk
Guest
 

Posts: n/a
Thanx RTM !!!

Isn't there any OS built system utility e.g. something like "sysdate"

Also I chked the post u suggested.
Another query --- When I type

# date
Wed Nov 13 13:54:09 CST 2002
#d=`TZ=a30 date +%a' '%b' '%e' '%T' '%Z' '%Y`
#echo $d
Tue Nov 12 13:54:38 a 2002

Now, Can you pls. help me how to display the Time Zone properly.

Regds,
Minaz
Reply With Quote
  #4  
Old 11-13-2002
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
There is not a sysdate in UNIX.

As far as your command, why are you setting the TZ and where are you getting the information? This is the portion that is incorrect.

(fyi - you don't need all those quotes)
$ d=`date +'%a %b %e %T %Z %Y'`
$ echo $d
Wed Nov 13 15:55:37 EST 2002
Reply With Quote
  #5  
Old 11-13-2002
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
What Unix are you using?
There may be a different answer if you're on Linux or if you have GNU Date installed...
Reply With Quote
  #6  
Old 11-13-2002
Registered User
 

Join Date: Aug 2002
Location: Philadelphia, PA
Posts: 75
I did it another way. Put a cron to run at 2315 daily to create a file with yesterday's date in whatever format u need. ANd read the file when u want. It is not the most elegant solution but it works for me!!
Reply With Quote
  #7  
Old 11-14-2002
minazk
Guest
 

Posts: n/a
I'm using SunOS 5.7
RTM - Thanx for the " quotes thing " but after setting TZ=a30, I get yesterday's date. Similarly I dont just want yesterday's date..it can be any number of days back.

Just for additional knowledge, if u can help me out with the timezone error then it would be great.

Anyways, i got a script which converts the date to any number of days back.



Thanx all for ur replies.

Minaz
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0