[gnu.utils.bug] bash: "$@" incorrect in functions

bliven@Atherton.COM (Andy Bliven) (12/13/89)

There is a difference in the way bash and sh handle "$@" in a
function.  Here is an example in sh:

    $ args () { for a in "$@"; do echo $a; done }
    $ args 1 2 3 4
    1
    2
    3
    4
    $

And the same example in bash:

    $ args () { for a in "$@"; do echo $a; done }
    $ args 1 2 3 4
    1 2 3 4
    $

I'm running on a Sun 3/60 with Sun UNIX 4.2 Release 3.5, and the ident
string in my bash is /bin/bash:

          $Id: gtest.c,v 1.10 88/07/02 13:34:45 afb Exp Locker: afb $

Does anyone have a fix?  Thanks,

Andy Bliven
-------------------------------------------------------------------
Atherton Technology			mail:	bliven@atherton.com
1333 Bordeaux Drive                  	phone:	408-734-9822
Sunnyvale, California 94089     	fax:	408-744-1607

chet@cwns1.CWRU.EDU (Chet Ramey) (12/14/89)

In article <15261@athertn.Atherton.COM> bliven@Atherton.COM (Andy Bliven) writes:
>There is a difference in the way bash and sh handle "$@" in a
>function.  Here is an example in sh:

There is a bug in how bash 1.04 handles "$@" in general.  I have sent fixes
for this to Brian, my bash does it correctly.

Chet Ramey
-- 
Chet Ramey
Network Services Group				"Where's my froggie?"
Case Western Reserve University
chet@ins.CWRU.Edu