943,739 Members | Top Members by Rank

Ad:
Aug 26th, 2009
0

How can i display time 5mins ago on Solaris 10

Expand Post »
Hi

Im writing a script where im using the date command in this format.

[Datestart=`date '+%m/%d/%Y':'%H:%M:%S'`]

Is their a way to force the date variable above to go back 5minutes??

I know their is a way in perl but i prefer writing this script in ksh
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007
Aug 26th, 2009
0

Re: How can i display time 5mins ago on Solaris 10

Shell Scripting Syntax (Toggle Plain Text)
  1. $ date '+%m/%d/%Y':'%H:%M:%S' ; date --date='now -5 minutes' '+%m/%d/%Y':'%H:%M:%S'
  2. 08/26/2009:18:25:41
  3. 08/26/2009:18:20:41
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Sep 1st, 2009
0

Re: How can i display time 5mins ago on Solaris 10

Hi Salem

Tried that on Solaris 10

[date '+%m/%d/%Y':'%H:%M:%S' ; date --date='now -5 minutes' '+%m/%d/%Y':'%H:%M:%S'
09/01/2009:11:11:30
date: illegal option -- date=now -5 minutes
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
]
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007
Sep 1st, 2009
0

Re: How can i display time 5mins ago on Solaris 10

Looks like you've got a crappy date then, and you need to use the perl way you know.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: A shell script that makes backup copies of changed files (also involving CRON)
Next Thread in Shell Scripting Forum Timeline: Need help to write a backup script...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC