The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compare file time pdr302 Shell Programming and Scripting 1 11-01-2007 07:14 PM
Compare Date And Time Jamil Qadir UNIX for Dummies Questions & Answers 5 01-10-2007 11:22 AM
compare update time of files dorilevy UNIX for Dummies Questions & Answers 8 05-27-2003 09:48 AM
compare files acess time AkumaTay UNIX for Dummies Questions & Answers 2 05-19-2002 03:02 PM
Rolling back time Cameron UNIX for Dummies Questions & Answers 5 03-26-2002 09:31 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-15-2008
maanik85 maanik85 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 2
Need to get 4 Hrs back time and compare with successive time

Hi all,

I am working on a script in which i need to get 4 hrs back time from the current time which i got from this perl function :

`perl -e 'print localtime(time() - 14400) . "\n"'`

now i need to get this in a loop and increment that time by 15 minutes
i.e
i=900(=15minutes)
`perl -e 'print localtime(time() - 14400+$i) . "\n"'`
I do not know perl much and the above code does not work . i have to compare time from a table column from a database which has a listing afer every 15 minutes . so basically i hv to get a loop in which i can use this function and compare the time which is exactly after every 15 minutes. there is a new lisitng in the Db after every 15 minutes and i need to check the time gap.

How can I compare time from this perl function or if there is any other script it will be really appreciated .

Thanks,
Manik
  #2 (permalink)  
Old 07-15-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,100
You have this: 'print localtime(time() - 14400+$i) . "\n"' which is a single-quoted string. It is stopping the shell from replacing $i with the value. You must move $i outside of the single quotes. So turn your single-quoted string into one single-quoted string, then $i, then another single-quoted string.



`perl -e 'print localtime(time() - 14400+'$i') . "\n"'`
  #3 (permalink)  
Old 07-15-2008
maanik85 maanik85 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 2
Thanks,
Its working . Really appreciate ur help

Last edited by maanik85; 07-15-2008 at 08:54 AM..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0