From 9831743319c31d01fdf5c30dde5fe3bef8603652 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 19 Oct 2022 21:01:03 -0700 Subject: [PATCH] Created SC1137 (markdown) --- SC1137.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 SC1137.md diff --git a/SC1137.md b/SC1137.md new file mode 100644 index 0000000..040058d --- /dev/null +++ b/SC1137.md @@ -0,0 +1,30 @@ +## Missing second '(' to start arithmetic for ((;;)) loop + +### Problematic code: + +```sh +for (i=0; i<10; i++)) +do + echo $i +done +``` + +### Correct code: + +```sh +for ((i=0; i<10; i++)) +do + echo $i +done +``` +### Rationale: + +ShellCheck found an arithmetic `for ((;;))` expression where either the `((` or the `))` did not come as a pair. Make sure to use `(( ))` and not `( )`. + +### Exceptions: + +None. + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file