diff --git a/SC2109.md b/SC2109.md new file mode 100644 index 0000000..3c24e56 --- /dev/null +++ b/SC2109.md @@ -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. \ No newline at end of file