From 2bfc5a9fa712cca4911827f29e1bd0ada7a40c07 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Wed, 14 Sep 2016 15:01:12 +0100 Subject: [PATCH] Created SC2007 (markdown) --- SC2007.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 SC2007.md diff --git a/SC2007.md b/SC2007.md new file mode 100644 index 0000000..0f95760 --- /dev/null +++ b/SC2007.md @@ -0,0 +1,27 @@ +# Use $((..)) instead of deprecated $[..] + +### Problematic code + +```sh +n=1 +n=$[n+1] +``` + +### Correct code + +```sh +n=1 +n=$((n+1)) +``` + +### Rationale + +The `$[..]` syntax was deprecated in Bash 2.0 and replaced with the standard `$((..))` syntax from Korn shell + +### Exceptions + +None. + +### See also + +- http://unix.stackexchange.com/questions/209833/what-does-a-dollar-sign-followed-by-a-square-bracket-mean-in-bash \ No newline at end of file