home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!unido!pki-nbg!hitkw14!smr
- From: smr@hitkw14.pki-nbg.philips.de (S.Riehm)
- Newsgroups: comp.unix.shell
- Subject: Re: Parameter Passing
- Message-ID: <smr.714056446@hitkw14>
- Date: 17 Aug 92 13:00:46 GMT
- References: <2676@nlsun1.oracle.nl>
- Sender: news@pki-nbg.philips.de
- Lines: 50
-
- rgasch@nl.oracle.com (Robert Gasch) writes:
-
- >I have written a shell script which accepts one parameter. The first
- >thing it does after making sure that it is /bin/sh and not some
- >other shell is check if the parameters are OK.
- >If I call it as
- > ap STRING_ARG
- > sh ap STRING_ARG
- >everything is fine. The parameter is recognized and life is great.
-
- >Here comes the confusion: As soon as I call it as
- > . ap STRING_ARG
- >the parameter is not recognized anymore. Even supplying it with
- >2 or more parameters does not change the fact that $# is equal to 0.
-
- >Could some kind soul out there explain what is going on and why
- >I get these strange reactions.
-
- I don't know if you would call me a kind soul, but here goes.
-
- the calls:
- ap STRING_ARG
- sh ap STRING_ARG
-
- are both starting new processes, with the full command line parameter
- handling, globbing and what not.
-
- . ap STRING_ARG
-
- on the other hand is invoking an inbuilt command of the shell,
- I guess the guess that wrote the . routine didn't bother checking for
- params. ( curiously enough, '. ap args' works on this machine, but I
- know the /bin/sh is already broken, so I don't trust it )
-
- You might like to try:
-
- set STRING_ARG
- . ap
-
- This also worked for me.. again sending parameter to functions doesn't
- work properly so this could be unique to HP's concept of /bin/sh
-
- catchya
-
- -----------------------------------------------------------------
- Stephen Riehm Configuration Management _-_|\
- smr@pki-nbg.philips.de Philips Kommunikations Industrie / \
- Work: +49 911 526 2975 Nuernberg, Germany \_.-.*/
- Fax: +49 911 526 2095 "I was there, now I am here!" v
- "My company speaks another language, I CAN'T speak on it's behalf"
-