Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ide!hartman From: hartman@ide.com (Robert Hartman) Newsgroups: comp.unix.wizards Subject: Re: evaluating ${10} and above in sh/ksh Keywords: sh, ksh, eval Message-ID: <1990Aug13.163532.14100@ide.com> Date: 13 Aug 90 16:35:32 GMT References: <514@risky.Convergent.COM> Sender: bert@ide.com (Bert Beaton) Organization: IDE, San Francisco Lines: 27 In article <514@risky.Convergent.COM> chrisb@risky.Convergent.COM (Chris Bertin) writes: >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? > This is what the shift builtin is for: # sort out arguments while [ $# -gt 0 ] ; do case $1 in -a) a=true ;; -b) b=true ;; -*) "echo illegal option" ;; *) "$files $i" ;; esac shift done This will process through all of your arguments and build a list of filenames. It doesn't work if options can have arguments of their own. For cases like this, I use getopts to parse out the command line. There's a good example in the getopts man page. -r