Under dash
shell, I see
for foo
>in
dash: Syntax error: "in" unexpected (expecting "do")
The POSIX shell grammar at
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02
has
for_clause :
(...)
| For name linebreak in
(...)
newline_list : NEWLINE
| newline_list NEWLINE
;
linebreak : newline_list
| /* empty */
so linebreak
does not have to be empty, but could be newline(s). Then why do I see that error? Is this a dash
bug?
bash
does accept this example, but clearly the example has nothing to do with any "bash-ism", it is just basic POSIX shell syntax, common to both dash
and bash
.