Building Variable Names in Bourne Shell

Ron Natalie ron at topaz.rutgers.edu
Wed Mar 23 08:36:22 AEST 1988


Try eval...

onestring="A"			# set the values of arbitrary strings
twostring="B"
threestring="C"
for string in one two three	# loop thru string sets
do
   var="${string}string"	# var contains the name of the string
				# I wish to get access to

     echo \$$var=`eval echo \\$$var`


done
 



More information about the Comp.unix.wizards mailing list