Date: Wed, 10 Jul 2002 13:30:03 -0700 (PDT) From: Chet Ramey <chet@nike.ins.cwru.edu> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/40386: Parsing problem with /bin/sh Message-ID: <200207102030.g6AKU3Dg038467@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/40386; it has been noted by GNATS. From: Chet Ramey <chet@nike.ins.cwru.edu> 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}' </dev/null > > || 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207102030.g6AKU3Dg038467>