morbig icon indicating copy to clipboard operation
morbig copied to clipboard

Two reserved keywords in a row should be considered both "well separated"?

Open Niols opened this issue 7 years ago • 3 comments

Let us have a look at:

{ for foo in a b c; do
      bar
  done }

refused by Morbig because of the } after done but accepted by Dash and Bash. I wonder if being "well separated" works when the previous word is already a reserved word. After all, we never separate after a reserved word, it's only important before.

Niols avatar Apr 01 '19 13:04 Niols

@yurug Do you think this is a bug in Morbig? Or a different interpretation of the standard?

Niols avatar Oct 30 '19 16:10 Niols

Actually, in 2.4 Reserved Words, it is said:

Reserved words are words that have special meaning to the shell; see Shell Commands. The following words shall be recognized as reserved words:

!             do            esac          in
{             done          fi            then
}             elif          for           until
case          else          if            while

This recognition shall only occur when none of the characters is quoted and when the word is used as:

  • The first word of a command
  • The first word following one of the reserved words other than case, for, or in
  • […]

Niols avatar Oct 30 '19 16:10 Niols

So this should, in my opinion, be a bug in Morbig and has actually nothing to do with "well separated" keywords (for which I can't find a reference anymore).

Niols avatar Oct 30 '19 16:10 Niols