Something else for people who are bored:
If I may ASS-U-ME that your ultimate goal is to have variables like:

LINE_THIS
LINE_THAT
LINE_THE_OTHER_THING

and you want to be able to change what is after the LINE part, if you have
genuine ksh93, and you like playing around with scripting stuff, then you
can try playing around with associative arrays.
For example:

LINE=([THIS]='ABC' [THAT]='XYZ' [THE_OTHER_THING]='HELLO WORLD')
X='THE_OTHER_THING'
echo ${LINE[$X]}
HELLO WORLD
X='THIS'
echo ${LINE[$X]}
ABC
X='THAT'
echo ${LINE[$X]}
XYZ

I think you must define the associative array as a single command; i.e. you
can't do
LINE=([THIS]='ABC')
LINE=([THAT]='XYZ')
because you will only have ${LINE[THAT]}

Note that, as far as I know, this stuff works only with ksh93.  Ksh88 is
probably much more predominant on non-Linux, and I think pdksh (public
domain ksh) -- which is useless for scripting -- shows up on Linux.  But you
can download and build ksh93.  Make sure you put the (){}[] characters in
the right places.

> -----Original Message-----
> 
> Hi List,
> 
> The requirement is as follows:
> 
> DBNAME=PROD ( 'DBNAME' variable contains value 'PROD' )
> 
> LINE_PROD=100 ( 'LINE_PROD' variable contains value 100 )
> 
> Now I want to echo the LINE_PROD variable using DBNAME variable.
> e.g 
> echo ${LINE_${DBNAME}} should return 100.
> 
> Is this possible and if yes, how ? I tried some ways but 
> couldn't find any way.
> 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Stephen Lee
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to