mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Rationale and example adopted from SC1054. Hopefully accurate.
14
SC1056.md
14
SC1056.md
@@ -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.
|
||||||
|
|
||||||
?
|
|
Reference in New Issue
Block a user