From c954655e97f575323d00d12dc9f533b7679290e2 Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 22 Aug 2015 12:19:10 -0700 Subject: [PATCH] Created SC1097 (markdown) --- SC1097.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 SC1097.md diff --git a/SC1097.md b/SC1097.md new file mode 100644 index 0000000..47c15f6 --- /dev/null +++ b/SC1097.md @@ -0,0 +1,29 @@ +## Unexpected ==. For assignment, use =. For comparison, use [/[[. + +### Problematic code: + + var==value + +### Correct code: + +Assignment: + + var=value + +Comparison: + + [ "$var" = value ] + +### Rationale: + +ShellCheck has noticed that you're using `==` in an unexpected way. The two most common reasons for this is: + +* You wanted to assign a value but accidentally used `==` instead of `=`. + +* You wanted to compare two values, but neglected to use `[ .. ]` or `[[ .. ]]`. + +### Exceptions: + +If you wanted to assign a literal equals sign, use quotes to make this clear: + + var="=sum(A1:A10)"