Path: utzoo!utgpu!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.unix.wizards Subject: Re: Is this known to unix.wizards? Message-ID: <912@philmds.UUCP> Date: 6 Jan 89 05:54:51 GMT References: <13307@ncoast.UUCP> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 24 In article <13307@ncoast.UUCP> allbery@ncoast.UUCP (Brandon S. Allbery) writes: |Every so often there is mention of /bin/sh's braindamaged handling of "$@" |when there are no arguments. I think I've worked out a way around it that |doesn't require "if" or "case": | | ${1+"$@"} | |The above construct should NOT be quoted. And I'm pretty sure it will work |on all versions of the Bourne shell. It seems to work in some tests I've |done here. Anyone else want to comment? I find it hard to believe that I'm |the first one to notice this, but I've never seen any discussion of it |anywhere and it *certainly* isn't in the manual or in any of the shell books |I've read. In article <15232@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: [Subject: Re: make bug] |echo ${1+"$@"} | sed -e "s/ /$suf /g" -e "s/$/$suf/" and |echo ${1+"$@"} | sed -e "s/$oldsuf /$newsuf /g" -e "s/$oldsuf$/$newsuf/" so at least Chris knew of the construct (or hacked up his scripts quickly after seeing Brandon's message 8-). Leo.