Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi guys, I know it may sound silly. I have this in my script:
JD=`date +%Y +%m|cut -c "4 5 6"`
echo $JDthe JD when I run it today outputs 803. Which is 8=part of year 2008, 03 is current month.
Is there a (simple) way of having outputted: 802 (that is always the year AND PREVIOUS month??).
e.g. when comes 1.1.2009, I'd like the JD output 812.
when it's 1.4.2008, I'd like to have variable JD = 803.
Please help!
Many thanks.

Referencing http://computing.net/unix/wwwboard/...
#!/bin/ksh
typeset -R3 JD
((HRS=$(date +%d)*24))
JD=$(TZ=aaa$HRS date +%y%m)
print $JD

![]() |
Moving recent files to an...
|
find duplicate value comp...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |