Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!ima!haddock!karl
From: karl@haddock.UUCP (Karl Heuer)
Newsgroups: comp.bugs.4bsd
Subject: Re: Arguments to 4.3BSD "sh -c" commands are mishandled
Message-ID: <201@haddock.UUCP>
Date: Mon, 15-Dec-86 22:52:40 EST
Article-I.D.: haddock.201
Posted: Mon Dec 15 22:52:40 1986
Date-Received: Wed, 17-Dec-86 04:44:21 EST
References: <7296@elsie.UUCP>
Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 14
Summary: Disagree

[Braces appearing below are used for quoting.  --kwzh]
In article <7296@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes:
>Type in the command { sh -c 'echo $*' a b c d } and note the incorrect
>output: { b c d }.

"That's not a bug, it's a feature!" :-)  "a" is being assigned to $0.  If you
don't care about $0, use a placeholder: { sh -c 'echo $*' sh a b c d }*.

It would be nice if this were documented, though.  I've never seen a man page
for sh that mentions the possibility of giving arguments to a { sh -c }, and
it's been implemented slightly differently in various incarnations.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
*Do not use "-" as the placeholder; argv[0][0]=='-' is magic!