From 37985cb9f7218a1272576a169b32c2d2664d94b5 Mon Sep 17 00:00:00 2001 From: koalaman Date: Tue, 27 Dec 2016 21:33:43 -0800 Subject: [PATCH] Created SC1108 (markdown) --- SC1108.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 SC1108.md diff --git a/SC1108.md b/SC1108.md new file mode 100644 index 0000000..757c4d8 --- /dev/null +++ b/SC1108.md @@ -0,0 +1,22 @@ +## You need a space before and after the = . + +### Problematic code: + +```sh +[ "$var"= 2 ] +``` + +### Correct code: + +```sh +[ "$var" = 2 ] +``` +### Rationale: + +You appear to be missing the space on the left side of the operator. Shell in general, and `[` in particular, is space sensitive. Operators and operands must be separate tokens. + +Please ensure that the operator, like the `=` in the example, has a space both before and after it. + +### Exceptions: + +None. If you're comparing values in C style reverse order like `[ -eq == $1 ]`, use quotes: `[ "-eq" == "$1" ]`. Also, it's pointless since `[ a = b ]` doesn't assign. \ No newline at end of file