Hi All,
Please let me know the error in the below code.
m=(0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
M=$(date +%m)
Y=$(date +%Y)
if [ $M == 12 ] ; then
M=01
Y=$(($Y+1))
else
M=$M+1)printf "01-%s-%d\n" ${m[$M]} $Y
fi
Log:
+ m=(0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
++ date +%m
+ M=09
++ date +%Y
+ Y=2013
+ '[' 09 == 12 ']'
/apps/powercdata/CS/TRAVEL_APPS/Scripts/payroll/gnw_Monthly_EURPayroll_ftp.sh: line 174: 09: value too great for base (error token is "09")
+ [[ 0 -ne 0 ]]
By the way, what shell are you scripting in? I know it might seem trivial, but if you are doing lots of calculations, you could save a process by doing internal calculations rather than `expr ....