Rationale and example adopted from SC1054. Hopefully accurate.

Martin Bagge / brother
2020-08-27 22:15:28 +02:00
parent 615a323066
commit 6f96f35adc

@@ -1,22 +1,20 @@
## Expected a '}'. If you have one, try a ; or \\n in front of it. ## Expected a '}'. If you have one, try a ; or \\n in front of it.
NEEDS WORK. Adding the boiler plate to avoid confusion.
### Problematic code: ### Problematic code:
```sh ```sh
true #!/bin/bash
bar() { echo "hello world"}
``` ```
### Correct code: ### Correct code:
```sh ```sh
true #!/bin/bash
bar() { echo "hello world";}
``` ```
### Rationale: ### Rationale:
? `}` is only recognized as the end of a command group when it's a separate token.
### Exceptions: If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing `echo "foo}"` with quotes, and therefore usually cause a syntax error.
?