tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* KSH question
@ 2002-05-16 15:54 Brewer, Edward
  0 siblings, 0 replies; only message in thread
From: Brewer, Edward @ 2002-05-16 15:54 UTC (permalink / 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-16 15:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-16 15:54 KSH question Brewer, Edward

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