Messages in this thread |  | | | Date | Tue, 21 Apr 1998 07:21:52 -0400 (EDT) | | From | "Steven N. Hirsch" <> | | Subject | Re: daemon-less kmod & Alpha no-go! |
| |
On 21 Apr 1998, Aaron M. Ucko wrote:
> "Steven N. Hirsch" <shirsch@ibm.net> writes: > > > The success of modprobe under the shell script started me thinking. I > > renamed /sbin/modprobe to /sbin/modprobe.real and created a stub > > /sbin/modprobe like this: > > > > #!/bin/sh > > shift > > /sbin/modprobe.real $* > > Ignoring for the moment the $*/"$@" issue (even though it's one of my > pet peeves), this script has two effects: it throws away the first > argument to modprobe (why?)
Why? Because the first argument is "/sbin/modprobe", the name of the little script itself. Recursive death results if we try to call ourselves.
> and it runs it as a child of an sh > process. Have you determined which of those makes the difference? > (To test just the first, exec modprobe.real
Which will accomplish nothing, as we have discarded the arguments to modprobe.real.
> ; to test just the second, > remove the shift.)
Locks up as it calls itself over and over and over...
> (Back to peeve:) As a general rule, you want "$@" instead of $* in sh > scripts; $* goes through things like globbing and word splitting, > which you don't want when you're passing all your arguments to > something else. > > (Essentially, "$@" is equivalent to > "$1" "$2" ... > and $* is equivalent to > $1 $2 ...)
Yes, you are correct. I generally use "$@", but since Adam had originally provided the framework using "$*" I kept that form in there.
Steve
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
|  |