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 > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
epoch time ali560045 Shell Programming and Scripting 3 06-02-2008 04:41 AM
EPOCH to real time? TheEngineer UNIX for Advanced & Expert Users 5 07-18-2006 08:30 AM
Epoch time 12yearold UNIX for Advanced & Expert Users 2 07-14-2006 03:11 PM
Epoch time 12yearold Shell Programming and Scripting 1 07-14-2006 11:57 AM
Convert from standard epoch time from a shell script? LordJezo Shell Programming and Scripting 4 09-18-2005 11:48 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2008
robsonde robsonde is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 162
epoch time in shell script

how can I get the current standard epoch time (seconds from 1970) in a shell script?

I know I could do this with a bit of perl of even c++ but i want to do it in Bourne shell.....
  #2 (permalink)  
Old 03-18-2008
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,206
date +%s should give you that.
  #3 (permalink)  
Old 03-18-2008
robsonde robsonde is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 162
Quote:
Originally Posted by reborg View Post
date +%s should give you that.
only with GNU date ,which we dont run on solaris systems :-(

Last edited by robsonde; 03-18-2008 at 10:19 PM..
  #4 (permalink)  
Old 03-18-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Recent Solaris versions have perl.

perl -e 'print time(), "\n" '
  #5 (permalink)  
Old 03-18-2008
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,382
And when perl is missing there is still nawk:

Code:
nawk 'BEGIN{print srand()}'
  #6 (permalink)  
Old 03-19-2008
robsonde robsonde is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 162
Quote:
Originally Posted by jlliagre View Post
And when perl is missing there is still nawk:

Code:
nawk 'BEGIN{print srand()}'
very cool, thanks
  #7 (permalink)  
Old 04-06-2008
McLan McLan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 21
HTML Code:
perl -e 'print time(), "\n" '  prints only epoch of system time
How to get epoch of some other time than current system time?
for example I want to know the epoch of Jan 1 2000, 00hrs 00 min 00 seconds
Sponsored Links
Closed Thread

Bookmarks

Tags
perl, perl shift, shift, shift perl, solaris

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 08:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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