From owner-freebsd-bugs Wed Jul 10 13:30: 8 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 107B837B401 for ; Wed, 10 Jul 2002 13:30:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7F36943E42 for ; Wed, 10 Jul 2002 13:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6AKU3JU038468 for ; Wed, 10 Jul 2002 13:30:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6AKU3Dg038467; Wed, 10 Jul 2002 13:30:03 -0700 (PDT) Date: Wed, 10 Jul 2002 13:30:03 -0700 (PDT) Message-Id: <200207102030.g6AKU3Dg038467@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Chet Ramey Subject: Re: bin/40386: Parsing problem with /bin/sh Reply-To: Chet Ramey Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/40386; it has been noted by GNATS. From: Chet Ramey To: keramida@FreeBSD.org Cc: chet@po.cwru.edu, bug-followup@FreeBSD.org Subject: Re: bin/40386: Parsing problem with /bin/sh Date: Wed, 10 Jul 2002 16:27:18 -0400 > On 2002-07-09 10:38 +0000, Chet Ramey wrote: > > There is a parsing problem with /bin/sh. The attached script should > > not work without a backslash at the end of the first line, but sh > > accepts it nevertheless. > > > quartz(2)# cat x1 > > awk '{print 12345}' > || exit 1 > > quartz(2)# ./sh ./x1 > > quartz(2)# /bin/bash ./x1 > > ./x1: line 2: syntax error near unexpected token `||' > > ./x1: line 2: ` || exit 1' > > Just to clarify a bit. There is nothing wrong with sh(1) here. The > first line is not continued to the second one with a backslash, and it > runs as expected. The second line is faulty though, because sh(1) > attempts to parse it as a complete command and it (correctly) fails. I think you misread the report. sh accepts the script without error, when it clearly should not. /bin/bash is the one that flags the error, and is included as an example of correct behavior. I used `./sh' from /usr/obj/usr/src/bin/sh so I could be sure that I had the latest version I cvsup'd. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message