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

  1. Path: sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!uwm.edu!linac!uchinews!machine!gagme!ddsw1!dattier
  2. From: dattier@ddsw1.mcs.com (DWT)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: how to get the last pos. parameter in ksh?
  5. Message-ID: <BxJCEH.75q@ddsw1.mcs.com>
  6. Date: 11 Nov 92 04:56:39 GMT
  7. References: <KURO.92Nov9112643@vodka.Eng.Sun.Com>
  8. Organization: Contributor Account at ddsw1, Chicago, Illinois  60657
  9. Lines: 17
  10.  
  11. kuro@Eng.Sun.Com wrote in <KURO.92Nov9112643@vodka.Eng.Sun.Com>:
  12.  
  13. | How can I write a ksh function to examine the last parameter (argument)
  14. | of the command line?  I.e., I'd like to know how to access argv[argc-1].
  15. | I tried:
  16. |     ${$#}
  17. | but this was interpreted as ${$} yielding the process id of the shell.
  18. | Another try:
  19. |     ${@[${@#}]}
  20. | gave me a syntax error.
  21.  
  22. Try
  23.  
  24. eval \${$#}
  25.  
  26. David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297
  27. dattier@ddsw1.mcs.com    CompuServe: 73720,1570    MCI Mail: 426-1818
  28.