Finding the last arg

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Mon Dec 31 15:16:07 AEST 1990


In article <1990Dec27.154917.14751 at virtech.uucp> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
| In article <18476 at shlump.nac.dec.com> lan_csse at netrix.nac.dec.com (CSSE LAN Test Account) writes:
| >The obvious thing to try is some sort of expression combining $# with ${},
| >e.g. ${$#}.  This gets a syntax error.  The simpler $$# is valid, but it
| 
| Try:
| 	eval \$$#

  With sh there is no valid way to do this, it breaks when $# > 9. With
ksh the followinf is true:
  eval echo $# \$##		# uses only one digit of $#
  eval echo $# \${$#}		# works for all values

  Hope that clarifies it. I treid several shells, all flavors of sh seem
to stop at $#>9 and need evaluation via shift.
-- 
bill davidsen - davidsen at sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.shell mailing list