Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14895
| From | Martijn Dekker <martijn@inlv.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | [minor] for/select parsing inconsistency |
| Date | 2018-12-07 14:02 +0100 |
| Message-ID | <mailman.5316.1544187783.1284.bug-bash@gnu.org> (permalink) |
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.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
[minor] for/select parsing inconsistency Martijn Dekker <martijn@inlv.org> - 2018-12-07 14:02 +0100
csiph-web