From 657f12cc15d50273429b4d6b382a1f570cfc8bde Mon Sep 17 00:00:00 2001 From: koalaman Date: Wed, 20 Jan 2016 14:58:52 -0800 Subject: [PATCH] Updated SC1010 (markdown) --- SC1010.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SC1010.md b/SC1010.md index 40fc864..7728c8a 100644 --- a/SC1010.md +++ b/SC1010.md @@ -2,16 +2,22 @@ ### Problematic code: +``` for f in *; do echo "$f" done +``` ### Correct code: +``` for f in *; do echo "$f"; done +``` ### Rationale: `done` only works as a keyword when it's the first token of the command. If added after a command, it will just be the literal word "done". +This is also true for other keywords like `then`. + ### Exceptions -If you're intentionally using `done` as a literal, you can quote it to make this clear to shellcheck (and also human readers), e.g. instead of `echo Task is done`, use `echo "Task is done"`. This makes no difference to the shell, but it will silence this warning. +If you're intentionally using `done` as a literal, you can quote it to make this clear to shellcheck (and also human readers), e.g. instead of `echo Task is done`, use `echo "Task is done"`. This makes no difference to the shell, but it will silence this warning.