mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2290 (markdown)
31
SC2290.md
Normal file
31
SC2290.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## Remove spaces around = to assign.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export LC_ALL = "POSIX"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export LC_ALL="POSIX"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
Parameters to `export`, `declare`, `local`, `typeset` and `readonly` may not have spaces around the `=` or `+=` operator. This is the same as for regular variable assignments:
|
||||||
|
|
||||||
|
export var = value # Invalid: spaces around =
|
||||||
|
export var =value # Invalid: space before =
|
||||||
|
export var= value # Invalid: space after =
|
||||||
|
export var=value # Valid
|
||||||
|
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
### Related resources:
|
||||||
|
|
||||||
|
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user