On Sat, 21 Oct 2006 14:36:04 +0000
Gerrit Pape <[EMAIL PROTECTED]> wrote:
> Hi A., I don't think dash and posh are at fault here...
> ...This means export x="$@" with $*="-f --c" will expand to export x=-f
> --c, and dash's error message is quite right. bash adds quotes in
> this case, but you actually should use "$*" AFAICT, that's what it's
> for.
>
> $ dash -xc 'foo() { export x="$@" ; } ; foo -f --c ; echo $?'
> + foo -f --c
> + export x=-f --c
> export: 1: --c: bad variable name
> $ bash -xc 'foo() {
> x="$@" ; } ; foo -f --c ; echo $?'
> + foo -f --c
> + x='-f --c'
> + echo 0
> 0
> $
>
> I'm about to close this bug, thanks, Gerrit.
Thanks for the detailed explanation, and the good advice how not to get
the error using "$*". And apologies for my misunderstanding... but in
hopes of extracting some public good from it, a last question:
If 'dash' and 'posh' behave correctly, and 'bash' does it differently,
would that indicate a bug in how 'bash' parses "$@"? The 'bash'
package description says:
% dlocate -s bash | grep -B 1 POSIX
Bash is ultimately intended to be a conformant implementation of the
IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).
Since 'dash' handles "$@" in a POSIX compliant way, therefore 'bash' does not.
If this is a 'bash' bug, then it would be more profitable to reassign
(and retitle) this bug to 'bash' rather than close it.
Note that the '--posix' switch of 'bash' doesn't make it act like 'dash':
% bash --posix
% foo() { export x="$@" ; } ; foo -f --c ; echo $?
0
HTH...
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]