cosell@BBN-LABS-B.ARPA (07/06/84)
From: Bernie Cosell <cosell@BBN-LABS-B.ARPA> AFter struggling some in trying to debug a shell script, I discovered that the source of my trouble was what seems to be a bug in the Bourne shell. Both our 4.2 and our V7 Bourne shells act the same way: The problem is with '"$@"'. This construct is claimed to expand to '"$1" "$2" ... "$n"'. Unfortunately, it seems just to throw away null args. That is, if your args are, say, "a", "b c ", and "d", then, as I would have expected, when I do 'nextprogram "$@"', nextprogram correctly is fed three args, the second of which is "b c ". Just right.... BUT... if your args are "a", "", and "d", then when you do 'nextprogram "$@"', nextprogram ends up with only TWO args - the "a" and the "d", with the null arg just gone. Thanks /Bernie cosell@bbn-unix
aeb@turing.UUCP (07/22/84)
About a year ago I posted the following fix: I have the strong impression that the following fixes the $@ bug mentioned. $ diff macro.c $S/macro.c 117,121c117,118 < THEN LOOP IF !*v ANDF *id=='@' < THEN pushstak(QUOTE); < ELSE WHILE c = *v++ < DO pushstak(c|quote); OD < FI --- > THEN LOOP WHILE c = *v++ > DO pushstak(c|quote); OD -- Andries Brouwer -- CWI, Amsterdam -- {philabs,decvax}!mcvax!aeb