Hi BIS,
the TZ variable specifies the timezone your system is in (for example GMT). This is set in the installation procedure.
So to calculate any date in Korn shell you can use something like that:
#!/bin/ksh
[[ $# -ne 1 ]] && echo "usage: x_days_back.ksh <how many days>"
DAYS_OFF=$1 # how many days you want to go back?
if [[ -n $DAYS_OFF ]] # check for non-zero string
then
((OFFSET = 24 * $DAYS_OFF)) # calculate in 24h format
TZ="$TZ+$OFFSET" # change timezone
backdate=`date +%d/%m/%y` # get the desired date
echo $backdate
fi
exit 0
You call the script like that:
./x_days_back.ksh 1 (for yesterday)
./x_days_back.ksh 3 (date three days back)
I hope I could help you with that explanation of TZ.
mrjazz
![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)