mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Add highlighting to last code-block
12
SC1036.md
12
SC1036.md
@@ -30,12 +30,14 @@ Determine what you intended the parenthesis to do and rewrite accordingly. Commo
|
|||||||
|
|
||||||
Bash allows some parentheses as part of assignment-like tokens to certain commands, including `export` and `eval`. This is a workaround in Bash to allow commands that normally would not be valid:
|
Bash allows some parentheses as part of assignment-like tokens to certain commands, including `export` and `eval`. This is a workaround in Bash to allow commands that normally would not be valid:
|
||||||
|
|
||||||
eval foo=(bar) # Valid command
|
```sh
|
||||||
echo foo=(bar) # Invalid syntax
|
eval foo=(bar) # Valid command
|
||||||
f=foo; eval $f=(bar) # Also invalid
|
echo foo=(bar) # Invalid syntax
|
||||||
|
f=foo; eval $f=(bar) # Also invalid
|
||||||
|
```
|
||||||
|
|
||||||
In these cases, please quote the command, such as `eval "foo=(bar)". This does not change the behavior, but stops relying on bash specific parsing quirks.
|
In these cases, please quote the command, such as `eval "foo=(bar)"`. This does not change the behavior, but stops relying on Bash-specific parsing quirks.
|
||||||
|
|
||||||
### Related resources:
|
### Related resources:
|
||||||
|
|
||||||
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
||||||
|
Reference in New Issue
Block a user