🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.shell
3 messages
3 total messages Started by Doug McNeil Sat, 10 Nov 1990 18:44
Evaluating a nexted variable
#1754
Author: Doug McNeil
Date: Sat, 10 Nov 1990 18:44
23 lines
907 bytes
Hello,

A friend needed to get the value of a variable which was contained in
a variable:

$a=b
$c=a

Determing the value of "a" given "c".

I came up with:

$eval z="$`echo $c`"
$echo $z

Not being a shell guru, I expect there are lots of better ways to do
this. Any comments?

--
----------------------------------------------------------------------------->
"Smokin" Doug McNeil			| ...!uunet!mitel!spock!mcneild
Mitel Corporation, Kanata, Ontario	| (613)592-2122
"I know a lot of fancy dancers.." - Cat Stevens	|
Re: Evaluating a nexted variable
#1755
Author: Paul John Falstad
Date: Sun, 11 Nov 1990 01:34
22 lines
996 bytes
In article <MCNEILD.90Nov10134417@mcneild.Software.Mitel.COM> mcneild@mcneild.Software.Mitel.COM (Doug McNeil) writes:
>$ a=b
>$ c=a
>Determing the value of "a" given "c".
>I came up with:
>$ eval z="$`echo $c`"
>$ echo $z

Or:

$ eval z=\$$c
$ echo $z

or:

$ eval echo \$$c


--
Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
"Your attention, please.  Would anyone who knows where the white courtesy
phone is located please pick up the white courtesy phone."
Re: Evaluating a nexted variable
#1758
Author: Conor P. Cahill
Date: Sun, 11 Nov 1990 04:48
11 lines
899 bytes
In article <MCNEILD.90Nov10134417@mcneild.Software.Mitel.COM> mcneild@mcneild.Software.Mitel.COM (Doug McNeil) writes:
>$eval z="$`echo $c`"

eval z=\$$c

will do what you want.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads