The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
grep unix.com with google



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

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-24-2009
Registered User
 

Join Date: Nov 2009
Posts: 24
date -d illegal option in Solaris

Hi All,

Is it possible to run date -d option in Solaris?
Do we have a work around so that -d option will be recognized
by solaris as it is recognized by linux.

I need this since i am using this in scripting and it works in Linux box. my problem is
it doesn't work in solaris box.

QUERY="rpm -qa --queryformat '%{installtime} %{name}-%{version}-%{release}-%{arch} \n'|
awk '{ if ( \$1 > '`date -d "1 week ago" +%s`') print \$2 }'"

Anyone can help me on this please ?

---------- Post updated at 02:46 PM ---------- Previous update was at 02:31 PM ----------

-Or-

Do we have equivalent commands for `date -d "1 week ago" +%s` in Solaris ?
  #2 (permalink)  
Old 11-24-2009
Registered User
 

Join Date: May 2008
Location: SINGAPORE.. The "FINE" City
Posts: 2,353
"date" command has only `-u` or `-a` options
  #3 (permalink)  
Old 11-24-2009
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 6,006
You are think of the GNU date implementation. POSIX date does not support those options. GNU unix tools are available as an add-on to Solaris.
  #4 (permalink)  
Old 11-24-2009
Registered User
 

Join Date: Aug 2009
Location: Croatia
Posts: 169
one question

how to update system date and time
  #5 (permalink)  
Old 11-24-2009
ɹǝsn sıɹɐlosuǝdo
 

Join Date: Dec 2007
Location: Paris
Posts: 1,658
If you are using a recent enough Solaris release, Gnu date might already be there:

Code:
$ uname -a 
SunOS pcjll 5.11 snv_128 i86pc i386 i86pc
$ /usr/gnu/bin/date -d "now -7 days" "+%s"
1258453453

otherwise, you have these nawk and perl solutions:

Code:
$ nawk 'BEGIN{print srand()-(7*24*60*60)}'
1258453618
$ perl -e 'printf("%s\n",time-(7*24*60*60));'
1258453627

  #6 (permalink)  
Old 11-24-2009
Registered User
 

Join Date: Aug 2009
Location: Croatia
Posts: 169
thanks jigi
  #7 (permalink)  
Old 11-25-2009
Registered User
 

Join Date: Nov 2009
Posts: 24
Thank guys for all your post..

God Bless you all!
Sponsored Links
Reply

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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Please help --setfacl: illegal option -- R manoj_dahiya22 SUN Solaris 2 03-14-2009 07:52 AM



All times are GMT -4. The time now is 02:18 PM.


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