From owner-freebsd-bugs Fri Mar 31 10:32: 8 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 E625437B959 for ; Fri, 31 Mar 2000 10:32:01 -0800 (PST) (envelope-from cracauer@knight.cons.org) Received: (from cracauer@localhost) by knight.cons.org (8.9.3/8.9.3) id UAA22818; Fri, 31 Mar 2000 20:31:45 +0200 (CEST) Date: Fri, 31 Mar 2000 20:31:45 +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: <20000331203145.A22722@cons.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from rb@ravenbrook.com on Fri, Mar 31, 2000 at 05:31:46PM +0100 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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