From e084a8cfdac050c068bff2bca75aa6f8811dabf6 Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 15 Aug 2015 22:15:55 -0700 Subject: [PATCH] Created SC2109 (markdown) --- SC2109.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 SC2109.md 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