Subject: Re: ash & POSIX 1003.2 q's
To: None <wollman@lcs.mit.edu>
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
List: tech-userlevel
Date: 01/27/1997 12:46:39
> 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