mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2110 (markdown)
17
SC2110.md
Normal file
17
SC2110.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
## "In [[..]], use || instead of -o.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
[[ "$1" = "-v" -o "$1" = "-help" ]]
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
[[ "$1" = "-v" || "$1" = "-help" ]]
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
`-o` for logical OR is not supported in a `[[ .. ]]` expression. Use `||` instead.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None.
|
Reference in New Issue
Block a user