|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
RE: Shell Script Date Help
#!/usr/bin/ksh
year=`date +%Y` today=`date +%j` day=`printf "%003d" $((today-1))` |
|
#3
|
|||
|
|||
|
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 |
|
#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.
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Shell Script Date Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|