I'm running the following code on three different levels of AIX and getting different results. It works fine on 5.3 and 7.1 but not 6.1. I'm running ksh version 88 on all three systems.
# Function GetDate nDays [format]
function GetDate
{
typeset -i nDays=$1; format=$2
eval $(echo $TZ | sed '
s!\([^-0-9]*\)\([-0-9]*\)\(.*\)!typeset -i localOffset=\2;zon1=\1;zon2=\3!')
TZ=$zon1$((localOffset-24*nDays))$zon2 date $format
}
prevdate=`GetDate -1 +%Y%m%d`
print $prevdate
Any idea on why it won't work on AIX 6.1?
# Function GetDate nDays [format]
function GetDate
{
typeset -i nDays=$1; format=$2
eval $(echo $TZ | sed '
s!\([^-0-9]*\)\([-0-9]*\)\(.*\)!typeset -i localOffset=\2;zon1=\1;zon2=\3!')
TZ=$zon1$((localOffset-24*nDays))$zon2 date $format
}
prevdate=`GetDate -1 +%Y%m%d`
print $prevdate
Any idea on why it won't work on AIX 6.1?