Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    The error should be what Kusalananda explains, but is that really the error message you see? I get syntax error: unexpected end of file (which is what I'd expect since the { } subshell is never closed because of the missing ;). What version of bash is this? Commented Dec 14, 2017 at 15:37
  • @terdon That is really it. "GNU bash, version 4.4.12(1)-release-(x86_64-pc-linux-gnu)" Commented Dec 14, 2017 at 15:44
  • OK, that's really weird. I'm using Arch and GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu) and don't get the first error. Commented Dec 14, 2017 at 16:24
  • you'd get a syntax error on the ( if the line had whitespace in middle of the function name, like foo bar() { .... But they'd need to be something the shell recognizes as whitespace. I couldn't come up with how to recreate that with invisible characters; my Bash accepts e.g. zero-width non-joiners as parts of the function name. :D Commented Dec 14, 2017 at 17:26