Opened 23 years ago

Closed 23 years ago

Last modified 23 years ago

#53 closed defect (fixed)

functions script uses $*, bison's yacc uses "$@"

Reported by: gerard@… Owned by: lfs-book@…
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 ;)

Change History (2)

comment:1 by gerard@…, 23 years ago

"$@" 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>

comment:2 by gerard@…, 23 years ago

Resolution: fixed
Status: newclosed

Closed along with bug #65

Note: See TracTickets for help on using tickets.