home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3611 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.2 KB  |  37 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!news
  3. From: Harald.Eikrem@delab.sintef.no
  4. Subject: Re: Parameter Passing
  5. In-Reply-To: smr@hitkw14.pki-nbg.philips.de's message of 17 Aug 92 13:00:46 GMT
  6. Message-ID: <1992Aug25.224815*Harald.Eikrem@delab.sintef.no>
  7. Sender: news@ugle.unit.no (NetNews Administrator)
  8. Organization: SINTEF DELAB, Trondheim, Norway.
  9. References: <2676@nlsun1.oracle.nl> <smr.714056446@hitkw14>
  10. Date: 25 Aug 92 22:48:15
  11. Lines: 24
  12.  
  13. rgasch@nl.oracle.com (Robert Gasch) went:
  14.  
  15. ! I have written a shell script which accepts one parameter. The first
  16. ! thing it does after making sure that it is /bin/sh and not some
  17. ! other shell is check if the parameters are OK.
  18. ! If I call it as
  19. !     ap STRING_ARG
  20. !     sh ap STRING_ARG
  21. ! everything is fine. The parameter is recognized and life is great.
  22. !
  23. ! Here comes the confusion: As soon as I call it as
  24. !     . ap STRING_ARG
  25. ! the parameter is not recognized anymore. Even supplying it with 
  26. ! 2 or more parameters does not change the fact that $# is equal to 0. 
  27.  
  28. In (Bourne) sh:
  29.  
  30.   inline_proc() { . shell_proc $@; }
  31.   inline_proc args....
  32.  
  33. should arrange for argument passing within the current shell invokation.
  34. (Anybody care to explain why?)
  35.  
  36.   ~~harald E
  37.