mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Add problematic/correct examples for readonly declarations
13
SC2155.md
13
SC2155.md
@@ -42,3 +42,16 @@ local foo="$(mycmd)"
|
||||
local foo
|
||||
foo=$(mycmd)
|
||||
```
|
||||
|
||||
### Problematic code in the case of `readonly`:
|
||||
|
||||
```sh
|
||||
readonly foo="$(mycmd)"
|
||||
```
|
||||
|
||||
### Correct code:
|
||||
|
||||
```sh
|
||||
foo="$(mycmd)"
|
||||
readonly foo
|
||||
```
|
Reference in New Issue
Block a user