I have this script:
day=`date +%d`
month=`date +%m`
year=`date +%Y`
lmonth=`expr $month - 1`
if test "$lmonth" = "0"
then lmonth=12
year=`expr $year - 1`
fi
The result when I call $lmonth/$year
is 9/2012
How can I make it output 09/2012
?
When the month is 10, 11 or 12 I don't want it to be 010, 011, or 012 respectively.
I want to put the $year and $lmonth when I call a table or file with period. For example, table_extra201209.
How do I add the extra zero for months from 1 (January) to 9 (September)?
I try all the answer here, but umm.. I forgot to mention something.. I want to put the $year and $lmonth when I call a table or file with periode, for example table_extra201209 how to put it on that with "0" attach before "9"..? thanks again :)