using shell variables as pointers

James R. Revell revell at cos.com
Thu Oct 6 01:57:22 AEST 1988


I need to write some shell scripts that can use shell variables as
pointers to other shell variables. I came up with one construct for
doing this, but I'm hoping that someone else has found a better one.
I would prefer using Bourne shell.

Here is an example of what I came up with:
	bin="bar/bin"
        src="moo/src"
	dir="bin"
	where="foo/`eval echo \\$${dir}`"
		( where is now "foo/bar/bin" )

	dir="src"
	where="foo/`eval echo \\$${dir}`"
		( where is now "foo/moo/src" )


-- 
James R. Revell Jr.  (8^{~  Corporation for Open Systems  (+1 703 883 2721)
revell at cos.com  _or_  {uunet,sundc,decuac,hqda-ai,hadron}!cos!revell
   The opinions expressed are not necessarily those of the Corporation
        for Open Systems, its members, or of any standards body.



More information about the Comp.unix.questions mailing list