Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jan 1997 12:46:39 -0500
From:      Chet Ramey <chet@odin.INS.CWRU.Edu>
To:        wollman@lcs.mit.edu
Cc:        vax@linkdead.paranoia.com, tech-userlevel@netbsd.org, freebsd-current@FreeBSD.ORG, chet@odin.INS.CWRU.Edu
Subject:   Re: ash & POSIX 1003.2 q's
Message-ID:  <9701271746.AA01284.SM@odin.INS.CWRU.Edu>
In-Reply-To: Message from wollman@lcs.mit.edu of Mon, 27 Jan 1997 11:58:38 -0500 (id <9701271658.AA27187@halloran-eldar.lcs.mit.edu>)

next in thread | previous in thread | raw e-mail | index | archive | help
> Of course, the POSIX folk have actually come up with a grammar for
> their version of the Bourne shell, but I would be surprised if anybody
> knew whether it actually described the input language of the
> original.  (Actually, I am quite certain that it doesn't, since the
> original Bourne shell didn't have shell functions.  But the point
> still stands even stipulating this.)

It doesn't.  Bash uses a yacc grammar and implements the POSIX.2
shell grammar almost exactly.  I've gotten dozens of bug reports
with the problem summarized in this FAQ:

----------
35) Why does bash report syntax errors when my C News scripts use a
    redirection before a subshell command?

The actual command in question is something like

        < file ( command )

According to the grammar given in the POSIX.2 standard, this construct
is, in fact, a syntax error.  Redirections may only precede `simple
commands'.  A subshell construct such as the above is one of the shell's
`compound commands'.  A redirection may only follow a compound command.
----------

The Bourne shell accepts this construct.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9701271746.AA01284.SM>