Created SC2109 (markdown)

koalaman
2015-08-15 22:15:55 -07:00
parent 5d456ad3ff
commit e084a8cfda

17
SC2109.md Normal file

@@ -0,0 +1,17 @@
## Instead of [ a || b ], use [ a ] || [ b ].
### Problematic code:
[ "$1" = "-v" || "$1" = "-help" ]
### Correct code:
[ "$1" = "-v" ] || [ "$1" = "-help" ]
### Rationale:
`||` can not be used in a `[ .. ]` test expression. Instead, make two `[ .. ]` expressions and put the `||` between them.
### Exceptions:
None.