Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!erik@naggum.se From: erik@naggum.se (Erik Naggum) Newsgroups: comp.unix.wizards Subject: Re: Building Variable Names in Bourne Shell Message-ID: <12655@brl-adm.ARPA> Date: 26 Mar 88 17:56:25 GMT Sender: news@brl-adm.ARPA Lines: 23 I thought this was obvious for the -wizards, so I sent kevinc@bearcat.lim.tek.com a private reply. The right thing to do is _eval_. No . or exec will do the job very fast. var='$'${foo}bar eval echo '$var = ' $var The very purpose of eval is to reevaluate the command line. (That is, first evaluate the arguments, then execute them, i.e. evaluate them once more.) To everyone of those who have proposed wierd solutions: Go read "An introduction to the UNIX Shell" by S. R. Bourne. (Sorry if this offends anyone, but negligence on the part of reading manuals is what I consider the hallmark of the novice. Besides, I learn more and more things from reading the same manuals over and over.) Yours in hacking (nonpejorative meaning), Erik Naggum UUCP -- erik@naggum.uucp UNIX is not ``eunuchs'' -- ARPA -- enag@ifi.uio.no in fact it's rather potent Snail -- Naggum Software; POB 1560 VIKA; OSLO 0118; NORWAY; +47-2-384-400