done
only works as a keyword when it's the first token of the command. If added after a command, it will just be considered as a literal string "done".
Exception: If you're intentionally using done
as a literal, you can quote it to make this clear to DeepSource (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.
This is also true for other keywords like then
.
for f in *; do echo "$f" done
or
echo $f is done
for f in *; do echo "$f"; done
or
echo "$f is done"