From owner-freebsd-bugs Sun Apr 2 23:57:43 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from knight.cons.org (knight.cons.org [194.233.237.86]) by hub.freebsd.org (Postfix) with ESMTP id BDB9137B95B for ; Sun, 2 Apr 2000 23:57:39 -0700 (PDT) (envelope-from cracauer@knight.cons.org) Received: (from cracauer@localhost) by knight.cons.org (8.9.3/8.9.3) id IAA04957; Mon, 3 Apr 2000 08:57:21 +0200 (CEST) Date: Mon, 3 Apr 2000 08:57:21 +0200 From: Martin Cracauer To: Richard Brooksby Cc: freebsd-bugs@FreeBSD.ORG, Ravenbrook System Administrators Subject: Re: Something funny about ampersand in /bin/sh Message-ID: <20000403085720.D4411@cons.org> References: <20000331203145.A22722@cons.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20000331203145.A22722@cons.org>; from cracauer@cons.org on Fri, Mar 31, 2000 at 08:31:45PM +0200 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Richard, you you please verify whether my assumption below is correct or not? Did you really use /bin/sh as shipped? In <20000331203145.A22722@cons.org>, Martin Cracauer wrote: > In , Richard Brooksby wrote: > > [Please retain Cc line when reply to this message.] > > > > I've just installed FreeBSD 3.4 on our new server and started > > migrating various things from our old server (running FreeBSD 2.2.8). > > One of my shell scripts broke, claiming "ambiguous redirection". By > > trial and error I discovered that ampersands are being treated > > specially in the shell in some way. For example, this no longer > > works: > > > > echo 2>&1 foo > > > > Instead of writing "foo" to stdout this puts "foo" in a file called "1". > > > > This looks like a serious bug in the shell to me, since it breaks a > > lot of shell scripts which use this kind of redirection. > > > > Mysteriously, this works: > > > > sh -c 'echo 2>&1 foo' > > Sorry, I tried FreeBSD's /bin/sh on 3.4-STABLE, 4.0-STABLE and > 5.0-current and all work right. > > $PWD2(\h)\!% uname -r > 3.4-STABLE > $PWD2(\h)\!% echo 2>&1 foo > foo > $PWD2(\h)\!% cat 1 > cat: 1: No such file or directory > > I assume that your example runs on another shell that got in your way > while upgrading. -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer http://www.cons.org/cracauer/ Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message