Date: Fri, 31 Mar 2000 20:31:45 +0200 From: Martin Cracauer <cracauer@cons.org> To: Richard Brooksby <rb@ravenbrook.com> Cc: freebsd-bugs@FreeBSD.ORG, Ravenbrook System Administrators <sysadmins@ravenbrook.com> Subject: Re: Something funny about ampersand in /bin/sh Message-ID: <20000331203145.A22722@cons.org> In-Reply-To: <p04310108b50a81a4dec3@[193.82.131.28]>; from rb@ravenbrook.com on Fri, Mar 31, 2000 at 05:31:46PM %2B0100 References: <p04310108b50a81a4dec3@[193.82.131.28]>
next in thread | previous in thread | raw e-mail | index | archive | help
In <p04310108b50a81a4dec3@[193.82.131.28]>, 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 <cracauer@cons.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000331203145.A22722>