From 31dc8a3c349dc085edef3c491f340686d7e938f3 Mon Sep 17 00:00:00 2001 From: koalaman Date: Mon, 17 Apr 2017 21:15:21 -0700 Subject: [PATCH] Created SC1116 (markdown) --- SC1116.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 SC1116.md diff --git a/SC1116.md b/SC1116.md new file mode 100644 index 0000000..ba0aeb1 --- /dev/null +++ b/SC1116.md @@ -0,0 +1,25 @@ +## Missing $ on a $((..)) expression? (or use ( ( for arrays). + +### Problematic code: + +```sh +var=((foo+1)) +``` + +### Correct code: + +```sh +var=$((foo+1)) +``` + +### Rationale: + +You appear to be missing the `$` on an assignment from an arithmetic expression `var=$((..))` . + +Without the `$`, this is an array expression which is either nested (ksh) or invalid (bash). + +### Exceptions: + +If you are trying to define a multidimensional Ksh array, add spaces between the `( (` to clarify: + + var=( (1 2 3) (4 5 6) )