mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1054 (markdown)
22
SC1054.md
Normal file
22
SC1054.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
## You need a space after the '{'.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
foo() {echo "hello world;}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
foo() { echo "hello world;}
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
`{` is only recognized as the start of a command group when it's a separate token.
|
||||||
|
|
||||||
|
If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing `"{echo"` with quotes, and therefore usually cause a syntax error.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None.
|
Reference in New Issue
Block a user