tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Brewer, Edward" <BREWERE@OD.NIH.GOV>
Subject: KSH question
Date: Thu, 16 May 2002 11:54:21 -0400	[thread overview]
Message-ID: <7B386924C5CAD0428322085D0F0F766F60AC12@ODEXC4> (raw)



Admins,

I have run into a problem concerning ksh.  I need to call up the value of a
variable into another variable but must define the variable with variables.
Here is an example of what I am referring to.

Let's say I have the following  variables 
SYSTEM_ABCD=1234
EXT=abcd

I need to 

command 1234

where SYSTEM_ABCD is defined by EXT

SYSTEM_$EXT

I could hard code the value, but I want it to read EXT to find SYSTEM_$ABCD
because I have  other values for other systems   such as SYSTEM_EFGH=5678

so,
I did the following

Variable list.....
SYSTEM_ABCD=1234
EXT=abcd
Variable list ends ...


INST=`echo EXT | tr -s '[:lower:]' '[:upper:]'`  # convert to uppercase
PASS = `echo '$SYSTEM_'$INST`
echo $PASS
command $PASS


the result is that echo $PASS gives $SYSTEM_ABCD
and the command fails, because it pass $SYSTEM_ABCD instead of 1234.

I have tried several tricks and combinations and they have had all of the
same results.  I know I have done this in the past but I can't figure out
how to make the shell interpret the string instead of treating it literal.

TIA,

Lee Brewer


                 reply	other threads:[~2002-05-16 15:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox