LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-05-2008, 07:50 PM   #1
ukursat
LQ Newbie
 
Registered: Apr 2007
Posts: 11

Rep: Reputation: 0
Date calculations on Sun sparc


Hi,

What is the equivalent of
"date --date="-1 days ago"" in Sun sparc?

My uname -a
SunOS xyz 5.10 Generic_127111-11 sun4u sparc


Regards,
kursat
 
Old 12-05-2008, 11:01 PM   #2
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 728

Rep: Reputation: 74
Hi.

One method:
Code:
#!/bin/ksh -

# @(#) s1       Demonstrate date arithmetic with datecalc.
# Extract datecalc from:
# http://www.unix.com/showthread.php?s=&postid=16559#post16559

echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) date datecalc
set -o nounset

echo
echo " Right now is $(date)"

echo
echo " Yesterday was:"
datecalc -a $( date '+%C%y %m %d' ) - 1

exit 0
Producing:
Code:
$ ./s1

(Versions displayed with local utility "version")
SunOS 5.10
ksh M-11/16/88i
date - ( /usr/xpg4/bin/date Jan 22 2005 )
datecalc - ( ~/bin/datecalc Dec 5 21:33 )

 Right now is Fri Dec  5 21:58:04 CST 2008

 Yesterday was:
2008 12 4
See the URL noted. You'll need to make the script datecalc available in your path.

Best wishes ... cheers, makyo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sun SPARC station 5 aronnok Solaris / OpenSolaris 2 09-11-2005 11:04 AM
Solaris Sparc Sun redhatrosh Solaris / OpenSolaris 4 03-26-2005 01:54 AM
7.3 sparc on Sun 220R graystarr SUSE / openSUSE 0 12-29-2004 07:06 PM
Date calculations in BASH script Crashman Programming 4 07-03-2004 11:15 AM
Sun Sparc Zonednode Solaris / OpenSolaris 3 02-13-2004 07:45 AM


All times are GMT -5. The time now is 01:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration