From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 3 Feb 1999 08:38:10 +0100 (MET) Message-Id: <199902030738.IAA10555@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-users@sunsite.auc.dk Subject: Re: OPTARG not being set? X-Mailing-List: 2066 Sweth Chandramouli wrote: > (astaroth)~1: joe='hello world' > (astaroth)~2: bob=joe > (astaroth)~3: echo ${joe} > hello world > (astaroth)~4: echo ${bob} > joe > (astaroth)~5: echo ${${bob}} > joe > (astaroth)~6: echo ${(e)bob} > joe > (astaroth)~7: echo "echo \${$(echo ${bob})}" > echo ${joe} > (astaroth)~8: `echo "echo \${$(echo ${bob})}"` > joe > (astaroth)~9: echo ${ZSH_VERSION} > 3.1.5 > > i would think that #5 should print hello world, > that #6 would explicitly cause parameter expansion and > print hello world, and that #8 would evaluate the results > of #7, which would be the same as typing #3, and would > thus print hello world. For standard 3.1.5 the syntax with an embedded ${...} inside a ${...} is only useful if the outer ${...} contains some flags or other modifying stuff. It will then work on the word(s) produced by the inner${...}. The (e) flag means the the string resulting from the whole ${...} will (at the end) be subject to another expansion (so if you had bob=\$joe, it would work). #8 irritates me, especially since: % $(echo "echo \${$(echo ${bob})}") yields ${b}. This almost certainly caused by some weird quoting rules, which may even be documented. Anyway, you should use eval for this: % eval echo "\$$bob" Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de