home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4618 < prev    next >
Encoding:
Internet Message Format  |  1992-11-09  |  1.0 KB

  1. Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!sdd.hp.com!cs.utexas.edu!natinst.com!news.dell.com!texsun!cronkite.Central.Sun.COM!west.West.Sun.COM!male.EBay.Sun.COM!jethro.Corp.Sun.COM!exodus.Eng.Sun.COM!exodus!kuro
  2. From: kuro@vodka.Eng.Sun.Com (Teruhiko Kurosaka)
  3. Newsgroups: comp.unix.shell
  4. Subject: how to get the last pos. parameter in ksh?
  5. Message-ID: <KURO.92Nov9112643@vodka.Eng.Sun.Com>
  6. Date: 9 Nov 92 17:26:43 GMT
  7. Reply-To: kuro@Eng.Sun.Com
  8. Organization: SunSoft, a Microsystems company, Mt.View, CA, USA
  9. Lines: 14
  10. NNTP-Posting-Host: vodka
  11.  
  12. How can I write a ksh function to examine the last parameter (argument)
  13. of the command line?  I.e., I'd like to know how to access argv[argc-1].
  14. I tried:
  15.     ${$#}
  16. but this was interpreted as ${$} yielding the process id of the shell.
  17. Another try:
  18.     ${@[${@#}]}
  19. gave me a syntax error.
  20. -kuro
  21. --
  22. -------
  23. T. Kurosaka ("Kuro") --- SunSoft, a Sun Microsystems company
  24. Internet:kuro@Eng.Sun.Com Voice:+1 415 336-5284 Fax:+1 415 336-6015
  25. US Mail: Mail Stop MTV5-44, 2550 Garcia Ave., Mt. View, CA 94043-1100 USA
  26.