-
Notifications
You must be signed in to change notification settings - Fork 1.9k
SC1063
Eisuke Kawashima edited this page Jul 29, 2025
·
3 revisions
for file in * do
echo "$file"
donefor file in *; do
echo "$file"
done
# or
for file in *
do
echo "$file"
doneShellCheck found a do on the same line as a loop, but do only starts a loop block at the start of a line/statement. Make the do the start of a new line/statement by inserting a linefeed or semicolon in front of it.
If you wanted to treat do as a literal string, you can quote it to make this clear to ShellCheck and humans:
for f in "for" "do" "done"
do
echo "Shell keywords include: $f"
done- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!