#53 closed defect (fixed)
functions script uses $*, bison's yacc uses "$@"
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Book | Version: | 3.0-pre3 |
Severity: | normal | Keywords: | |
Cc: |
Description
bison's yacc creation uses "$@" to pass all parameters passed to yacc to bison.
the functions script, in the loadproc function uses $* to start a daemon.
Perhaps we should change the functions script to use "$@" (including those quotation marks) as well? I can't quite remember what the difference is between $* and "$@" (it's in cvs log, but cvs is down right now). It's in bash man page somewhere too, so I'll find it at some point, but if somebody can enlighten me that would be greatly appreciated ;)
Note:
See TracTickets
for help on using tickets.
"$@" it is: <quote Claudio Nieder <private@…>
The issue with $*, "$*" and "$@" is this: $ cat >caller <<'EOF' #!/bin/sh echo -n '$* args:' ./argtest $* echo -n '"$*" args:' ./argtest "$*" echo -n '"$@" args:' ./argtest "$@" EOF
$ chmod 755 caller argtest
$ cat > argtest << EOF #!/bin/sh echo " \$#" EOF
$ ./caller "one and a half" two three $* args: 6 "$*" args: 1 "$@" args: 3 only "$@" gives you the same three arguments which you originally passed to caller. $* will split the quoted "one and a half" into four arguments while "$*" will make one argument out of everything passed to caller. "$@" is magical as it preserves the argument structure. </quote>