I have korn shells where I want to create a function passing $1 to a function , determine my $STAT_ENV value, set the paths and return
the paths for STATSH,STATPRM,STATSQR,STATSQL,STATCTL TO BE USED IN THE UNIX SCRIPT THE CALLED THE fucnction in the first place.
Can someone tell me the best way to do this. It will be used in my production env.
# this would be my function
STAT_ENV=`echo "$1" | cut -c6-6`
echo "$2 $STAT_ENV"
> $logfile
if [[ "$STAT_ENV" = "e" ]];
then
SHELL=shd
PARMS=prmd
SQR=sqrd
PAR=pard
SQL=sqld
CTL=ctld;
elif [[ "$STAT_ENV" = "i" ]];
then
SHELL=shi
PARMS=prmi
SQR=sqri
PAR=pari
SQL-sqli
CTL=ctli;
elif [[ "$STAT_ENV" = "u" ]];
then
SHELL=shu
PARMS=prmu
SQR=sqru
PAR=paru
SQL=sqlu
CTL-ctlu;
else
SHELL=shp
PARMS=prmp
SQR=sqr
PAR=par
SQL=sql
CTL=ctl;
fi
#
STATSH=/first/apps/$SHELL
STATPRM=/first/apps/$PARMS
STATSQR=/first/apps/$SQR
STATSQL=/first/apps/$SQL
STATCTL=/first/apps/$CTL