Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2000 17:31:46 +0100
From:      Richard Brooksby <rb@ravenbrook.com>
To:        freebsd-bugs@freebsd.org
Cc:        Ravenbrook System Administrators <sysadmins@ravenbrook.com>
Subject:   Something funny about ampersand in /bin/sh
Message-ID:  <p04310108b50a81a4dec3@[193.82.131.28]>

next in thread | raw e-mail | index | archive | help
[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'

but this doesn't:

   su -fm root -c 'echo 2>&1 foo'

Since our server relies on this kind of redirection I'd appreciate a 
workaround as soon as possible.

Thanks.
-- 
Richard Brooksby <rb@ravenbrook.com>          Senior Consultant
Ravenbrook Limited, 51 St. Andrew's Road, Cambridge CB4 1DH, UK
Tel +44 1223 519215    Fax +44 870 1641432   www.ravenbrook.com


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?p04310108b50a81a4dec3>