Xref: utzoo comp.unix.wizards:23417 comp.unix.questions:24607 Path: utzoo!attcan!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: evaluating ${10} and above in sh/ksh Message-ID: <7300@star.cs.vu.nl> Date: 13 Aug 90 20:00:46 GMT References: <514@risky.Convergent.COM> Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Dept. of Computer Science, Amsterdam, The Netherlands Lines: 32 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... Alas... POSIX fixes this though: ${10} will work. )I have tried many different ways and they all fail. Do you know one )that will work? set a b c d e f g h i j k l m argv() { shift $1 2> /dev/null echo "$1" } echo `argv 10 "$@"` echo `argv 11 "$@"` echo `argv 20 "$@"` Beware of "$@": many shells will expand it to a single null string if there are no positional parameters present at all! A safe workaround is: ${1+"$@"} Check it out in the manual! -- "UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." (Doug Gwyn)