From owner-freebsd-questions Tue Jul 2 10:26:26 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id KAA23986 for questions-outgoing; Tue, 2 Jul 1996 10:26:26 -0700 (PDT) Received: from rk.ios.com (rk.ios.com [198.4.75.55]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id KAA23981 for ; Tue, 2 Jul 1996 10:26:20 -0700 (PDT) Received: (from rashid@localhost) by rk.ios.com (8.7.5/8.7.3) id NAA12316; Tue, 2 Jul 1996 13:25:15 -0400 (EDT) From: Rashid Karimov Message-Id: <199607021725.NAA12316@rk.ios.com> Subject: Re: Bug in /bin/sh To: mike@networx.ie Date: Tue, 2 Jul 1996 13:25:15 -0400 (EDT) Cc: questions@freebsd.org In-Reply-To: from "Michael Ryan" at Jul 2, 96 05:20:15 pm Content-Type: text Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk it is well known that classic "sh" is buggy. It fails for example on some complex "configure" scripts ... can't recall the name of the product, I think it's something from GNU project. Use bash instead. Rashid. > Can anybody confirm that there is a bug in /bin/sh in FreeBSD v2.1, > which the following commands illustrate... > > ------------------------------------------ > $ cat > shbug > #! /bin/sh -- > f () { > echo start > test $1 = abc && { > echo middle > return 1 > } > there is no command called "there" & > echo end > return 0 > } > f $1 > exit 0 > ^D > $ chmod +x shbug > $ shbug abc > start > end > $ middle > ------------------------------------------ > > Note how the "echo end" statement got executed, eventhough it > should not have? Also, it doesn't complain about the command > "there" not being found. > > It's the "&" at the end of the "there" command that seems to > confuse the shell. Remove it and the script works as you'd > expect. > > Please email any replies to me directly (as well as to the > list if you like), as I'm not on the mailing list right now. > > > Thanks, > Mike > > --- > > > >