2

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.

Mark Galeck
  • 6,155
  • 1
  • 28
  • 55
  • 1
    What version of `dash` do you use (what platform does it come with)? I don't see this behavior in v0.5.8. – mklement0 Aug 30 '16 at 01:29
  • 1
    I can duplicate the error with `for foo in ...` in 0.5.8. – chepner Aug 30 '16 at 01:39
  • 1
    @mklement0 0.5.7, so yes, looks like that is a bug in that version. Unfortunately for me, I have to use 0.5.7 ... Because 0.5.8 is _too_strict_ :) - it fixed some other bug, which a script relies on, and I can't change that script. That's why I cannot upgrade to 0.5.8. Auwe! as Hawaiians would say. – Mark Galeck Aug 30 '16 at 01:43

0 Answers0