![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| date -d nightmare on Solaris | pavanlimo | SUN Solaris | 1 | 04-02-2009 11:34 AM |
| LTO Compatibility | Shawn Paul | HP-UX | 2 | 09-29-2008 03:24 AM |
| About compatibility of HP-UX 11i | Irene Martínez | HP-UX | 0 | 02-29-2008 01:05 PM |
| Disks compatibility | ppass | SUN Solaris | 0 | 12-05-2007 05:00 AM |
| compatibility problem ??!! | oti | Shell Programming and Scripting | 3 | 05-17-2002 07:46 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hello there ppl,
I thought my question would qualify to be posted in this forum and in Solaris forum. And I swear to God.. there is no discussion on this exact topic anywhere else on the web! So my script on BASH uses 2 commands: 1) date -d "Fri Mar 06 10:18:16 UTC 2009" +%s This command converts the specified time into localtime(with local timezone) and then into epoch(number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970). 2) date -d "last Sunday" +%s This command gives the time in epoch of the immediately previous Sunday. Now I'm clueless about how to make my script compatible with Solaris. Some pointers I found through google, not much of a help :|. They suggested me to use perl -e "print time;" This prints only the current epoch time, doesn't take 'time' as input, let alone "last Sunday" as input. So.. guys who would help solve these 2 cases will win a free lifetime holiday to mars! Really! ![]() No, seriously, I would appreciate any help, whatsoever. |
|
||||
|
It is not bash you need, it is GNU date. Those extensions are part of the date program that comes with most versions of Linux.
If you have Solaris the GNU core utilities are available for it, free of charge. Sunfreeware - Freeware Open Source Software for Sun Microsystem's Solaris Select your version of Solaris and download what you want. |
|
|||||
|
Or else use what I had to do and that is write a perl script to translate date to epoch, e.g. the one at:
http://www.cpan.org/authors/id/J/JM/JMATES/date2epoch I would have had trouble installing a GNU date command but already had perl! |
|
||||
|
Thanks Jim, Tony for your super quick replies.
Jim, installing GNU utilities is not an option if this script is shipped to a customer. Since we can't expect the customer to install the utilities. Tony, your solution solves one of my two problems, however, it would be great if we can find a solution without having to create a separate perl file. Guess 'm still in rough state :|. |
![]() |
| Bookmarks |
| Tags |
| solaris date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|