home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / shell / 3501 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  2.0 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!unido!pki-nbg!hitkw14!smr
  2. From: smr@hitkw14.pki-nbg.philips.de (S.Riehm)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: Parameter Passing
  5. Message-ID: <smr.714056446@hitkw14>
  6. Date: 17 Aug 92 13:00:46 GMT
  7. References: <2676@nlsun1.oracle.nl>
  8. Sender: news@pki-nbg.philips.de
  9. Lines: 50
  10.  
  11. rgasch@nl.oracle.com (Robert Gasch) writes:
  12.  
  13. >I have written a shell script which accepts one parameter. The first
  14. >thing it does after making sure that it is /bin/sh and not some
  15. >other shell is check if the parameters are OK.
  16. >If I call it as
  17. >    ap STRING_ARG
  18. >    sh ap STRING_ARG
  19. >everything is fine. The parameter is recognized and life is great.
  20.  
  21. >Here comes the confusion: As soon as I call it as
  22. >    . ap STRING_ARG
  23. >the parameter is not recognized anymore. Even supplying it with 
  24. >2 or more parameters does not change the fact that $# is equal to 0. 
  25.  
  26. >Could some kind soul out there explain what is going on and why
  27. >I get these strange reactions.
  28.  
  29. I don't know if you would call me a kind soul, but here goes.
  30.  
  31. the calls:
  32. ap STRING_ARG
  33. sh ap STRING_ARG
  34.  
  35. are both starting new processes, with the full command line parameter
  36. handling, globbing and what not.
  37.  
  38. . ap STRING_ARG
  39.  
  40. on the other hand is invoking an inbuilt command of the shell, 
  41. I guess the guess that wrote the . routine didn't bother checking for
  42. params. ( curiously enough, '. ap args' works on this machine, but I
  43. know the /bin/sh is already broken, so I don't trust it )
  44.  
  45. You might like to try:
  46.  
  47. set STRING_ARG
  48. . ap
  49.  
  50. This also worked for me.. again sending parameter to functions doesn't
  51. work properly so this could be unique to HP's concept of /bin/sh
  52.  
  53. catchya
  54.  
  55. -----------------------------------------------------------------
  56. Stephen Riehm        Configuration Management       _-_|\ 
  57. smr@pki-nbg.philips.de    Philips Kommunikations Industrie  /     \
  58. Work: +49 911 526 2975    Nuernberg, Germany          \_.-.*/
  59. Fax:  +49 911 526 2095    "I was there, now I am here!"           v 
  60. "My company speaks another language, I CAN'T speak on it's behalf"
  61.