Shell Scripting Help
chrisl at xp.etowns.net
chrisl at xp.etowns.net
Mon May 14 21:05:46 UTC 2007
I have the following script:
#!/usr/bin/ksh
CURRMONTH=`date +%m`
date '+%m %d %Y' |
{
read MONTH DAY YEAR
DAY6=`expr "$DAY" - 1`
case "$DAY6" in
0)
MONTH=`expr "$MONTH" - 1`
case "$MONTH" in
0)
MONTH=12
YEAR=`expr "$YEAR" - 1`
;;
esac
DAY6=`cal $MONTH $YEAR | grep . | fmt -1 | tail -1`
esac
echo "1 day ago was: $MONTH $DAY6 $YEAR"
The value DAY6 would be 13 if run today. If it was run on the 10th it would be 9.
I need to have DAY6 displayed as 09 and not just 9, is this possible?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070514/8137fe9f/attachment.html>
More information about the ubuntu-users
mailing list