Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!apple!voder!pyramid!ctnews!risky!chrisb From: chrisb@risky.Convergent.COM (Chris Bertin) Newsgroups: comp.unix.wizards Subject: evaluating ${10} and above in sh/ksh Keywords: sh, ksh, eval Message-ID: <514@risky.Convergent.COM> Date: 10 Aug 90 17:58:37 GMT Organization: Convergent Technologies, San Jose, CA Lines: 29 There doesn't seem to be a way, in sh or ksh, to evaluate $10 and higher. $10 and higher are evaluated as ${1}0, ${1}1, etc... instead of ${10}, ${11}, etc... I have tried many different ways and they all fail. Do you know one that will work? #! /bin/sh set a b c d e f g h i j k l arg=0 while [ $arg -le $# ]; do echo "evaluating \$$arg" eval echo $"$arg" eval echo $"${arg}" eval echo "$`eval echo $arg`" # Now, some of the crazy things I tried. # ( The parens are there when eval causes an error ) echo "\${$arg} results in \c" ( eval echo "\${$arg}" ) echo "$`echo '{'``eval echo $arg``echo '}'` results in \c" ( eval echo "$`echo '{'``eval echo $arg``echo '}'`" ) arg=`expr $arg + 1` done -- Chris Bertin | chrisb@risky.Convergent.COM Unisys | or (408) 435-3762 | ...!uunet!pyramid!ctnews!risky!chrisb