From 56a5e1772e95a4d69f18a4b59eff02704e946cce Mon Sep 17 00:00:00 2001 From: koalaman Date: Wed, 19 Feb 2014 12:52:49 -0800 Subject: [PATCH] Created SC1068 (markdown) --- SC1068.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 SC1068.md diff --git a/SC1068.md b/SC1068.md new file mode 100644 index 0000000..76e667e --- /dev/null +++ b/SC1068.md @@ -0,0 +1,17 @@ +# Don't put spaces around the = in assignments. + +### Problematic code: + + foo = 42 + +### Correct code: + + foo=42 + +### Rationale: + +Shells are space sensitive. `foo=42` means to assign `42` to the variable `foo`. `foo = 42` means to run a command named `foo`, and pass `=` as `$1` and `42` as `$2`. + +### Contraindications + +If you actually wanted to run a command named foo and provide `=` as the first argument, simply quote it to make ShellCheck be quiet: `foo "=" 42`. \ No newline at end of file