simon@its63b.ed.ac.uk (ECSC68 S Brown CS) (12/07/86)
In article <106@quacky.UUCP> dce@quacky.UUCP (David Elliott) writes: > >There is one slight problem with "$@", which can be shown by the following > > [... example of the wll-known "feature" ...] > >Anyway, the following statement can be used to fix this bug in most >versions of sh. > > if (strcmp (as, "\"$@\"") == 0 && dolc == 0) { > return(fixstak()); > } > >Add these to the beginning of the subroutine macro() in macro.c, and the >bug goes away. It is somewhat kludgy, but it works. > However, if you fix this in your version of sh, it makes any shell-scripts that you may write assuming the "fixed" behaviour inherently non-portable, 'cos they'll immediately bomb out on standard shells. So, until the fix described above (or some equivalent thereof) is official, its probably better just to be very careful when using $* or $@ in scripts. One foolproof way is to always use ${1+"$@"} in place of $* or $@ or "$@" - ok, its ugly, I know... :-) -- Simon Brown Department of Computer Science, University of Edinburgh, Scotland. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Life's distressing - that's no blessing". [Anon.] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~