SunQuest
           Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old January 6th, 2006, 10:45 AM
Dawg Dawg is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 28 Dawg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Shell Script Date Help

Greetings,
I have a shell script that outputs a date (amoung other things) to retrive some files from a remote server. When the new year rolled over it stopped working.

I found out the output from the script is giving me a date of 5 instead of 005. Here is the date portion of the script...

year=`date +%Y`
today=`date +%j`
day=$((today-1))

I do not know a thing about shell scripting....but I do know that the date must be in this format for the output.

001, 002, 003, 114, 365

It must have all three digits to work right.

Could someone "In the KNOW" either point me in the right direction or show me the error of my ways.

Reply With Quote
  #2  
Old January 6th, 2006, 08:21 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: Shell Script Date Help

#!/usr/bin/ksh
year=`date +%Y`
today=`date +%j`
day=`printf "%003d" $((today-1))`

Reply With Quote
  #3  
Old January 6th, 2006, 09:09 PM
Dawg Dawg is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 28 Dawg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Shell Script Date Help

Thank You nawlej, Do you happen to know a good source for this type of info?

I found a couple through google but nothing I would consider a "Manual".

Thank You again for your time!!!

Dawg

Reply With Quote
  #4  
Old January 6th, 2006, 11:16 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: Shell Script Date Help

Not really...I've got a couple of coffee stained references I go to, but it's been second had to me for years now.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > Shell Script Date Help


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway