Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14895 > unrolled thread

[minor] for/select parsing inconsistency

Started byMartijn Dekker <martijn@inlv.org>
First post2018-12-07 14:02 +0100
Last post2018-12-07 14:02 +0100
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  [minor] for/select parsing inconsistency Martijn Dekker <martijn@inlv.org> - 2018-12-07 14:02 +0100

#14895 — [minor] for/select parsing inconsistency

FromMartijn Dekker <martijn@inlv.org>
Date2018-12-07 14:02 +0100
Subject[minor] for/select parsing inconsistency
Message-ID<mailman.5316.1544187783.1284.bug-bash@gnu.org>
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.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web