here is the thing i am trying to do . I have a system variable called $OOCEA_INCOMING_READY, I want to be able to construct this variable name inside the script and use it. I am passing part of the variable name OOCEA as parameter but i am not able to use this variable after constructing the name , see below :
----------------- code a.sh ----------------------------------------------
#!/usr/bin/ksh
set -x
AGENCY=$1
AGENCY_CODE=$2
FILE_TYPE=$3
#
echo \$${AGENCY}_INCOMING_READY
ls \$${AGENCY}_INCOMING_READY
ls $OOCEA_INCOMING_READY
exit
-------------------------------------------------------------------------


./a.sh OOCEA 05 ITRN

+ AGENCY=OOCEA
+ AGENCY_CODE=05
+ FILE_TYPE=ITRN
+ echo $OOCEA_INCOMING_READY <<<< does not work
$OOCEA_INCOMING_READY
+ ls $OOCEA_INCOMING_READY <<<< does not work
$OOCEA_INCOMING_READY: No such file or directory
+ ls /u02/oocea/incoming/ready <<< this works if i hard code the
ITRN_20090430_0030.ZIP ITRN_20090430_1230.ZIP variable name .
+ exit

Check out the "eval" command.

Edit: I.E.

eval "echo \$${AGENCY}_INCOMING_READY"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.