Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Martijn Dekker Newsgroups: gnu.bash.bug Subject: [minor] for/select parsing inconsistency Date: Fri, 7 Dec 2018 14:02:49 +0100 Lines: 24 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1544187783 18387 208.118.235.17 (7 Dec 2018 13:03:03 GMT) X-Complaints-To: action@cs.stanford.edu To: Bug reports for the GNU Bourne Again SHell Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 37.59.109.123 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14895 There is a minor inconsistency in grammatical parsing between 'for' and 'select' loops. Since 'select' is basically a glorified 'for', it seems to me that they should parse the same way. $ bash -c 'for x in; do :; done' $ bash -c 'select x in; do :; done' bash: -c: line 0: syntax error near unexpected token `;' bash: -c: line 0: `select x in; do :; done' $ bash -c 'foo=; select x in $foo; do :; done' $ An empty iteration argument list is not accepted by 'select', unless it results from an expansion. 'for' does accept this. On ksh93, mksh, and zsh, both 'for' and 'select' accept a literal empty list. On shells without 'select' (dash, yash), 'for' accepts it. So it seems to me that 'select' on bash should change to match 'for'. Thanks, - M.