From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13020 invoked from network); 15 Jun 2003 20:27:23 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 Jun 2003 20:27:23 -0000 Received: (qmail 26138 invoked by alias); 15 Jun 2003 20:27:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18610 Received: (qmail 26127 invoked from network); 15 Jun 2003 20:27:17 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 15 Jun 2003 20:27:17 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.64.233.9] by sunsite.dk (MessageWall 1.0.8) with SMTP; 15 Jun 2003 20:27:16 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h5FKRFI20036 for zsh-workers@sunsite.dk; Sun, 15 Jun 2003 13:27:15 -0700 From: Bart Schaefer Message-Id: <1030615202714.ZM20035@candle.brasslantern.com> Date: Sun, 15 Jun 2003 20:27:14 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Misc. musings on shell grammar (plus a bug?) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Musing about the grammar documentation, actually, not about the grammar itself. The grammar (ignoring redirections) as described by the corresponding section of the manual is roughly simple ::= wordlist | modifier simple pipeline ::= simple PIPE pipeline | simple coprocess ::= "coproc" pipeline sublist ::= pipeline JOIN sublist | pipeline clist ::= sublist SEP clist | sublist list ::= clist SEP | complex ::= "(" clist ")" | "{" clist "}" | "[[" exp "]]" | if | for | while | until | repeat | case | select | time [Grammars of structured commands omitted for brevity.] I first note the omission of "((math))" here. There should at least be a mention of that in the grammar section. Another note is that the placement of at least "[[exp]]" and "time" is misleading. "[[exp]]" behaves like a "list" in that no separator is needed when it appears before a keyword in a structured command, and "time" belongs somewhere between "pipeline" and "sublist". A more accurate representation of the grammer would be simple ::= wordlist | modifier simple complex ::= "(" clist ")" | "{" clist "}" | "[[" exp "]]" | math | if | for | while | until | repeat | case | select statement ::= simple | complex pipeline ::= statement PIPE pipeline | statement job ::= pipeline | coprocess ::= "coproc" job timeline ::= "time" job process ::= pipeline | coprocess | timeline sublist ::= process JOIN sublist | process nonempty ::= sublist SEP nonempty | sublist clist ::= nonempty | list ::= clist SEP | complex | math ::= "((" "))" And I have no idea why I just spent more than an hour working that out except that perhaps it'll give somebody else (or me, when I reread it later) some ideas for how to improve the documentation. Even so, it's still not quite right because some combinations of "time" and "coproc" that are valid (though not very useful) can't be derived. Now for the "bug" -- this is 4.0.6, but 4.1.1-testX behaves the same: schaefer[501] if false & then echo oops & fi [2] 20011 [2] + exit 1 false oops [2] 20012 [2] + done echo oops I suppose this makes sense -- this test would be false only if "false" could not be backgrounded, e.g., fork failure?