mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC1063 (markdown)
@@ -15,13 +15,14 @@ for file in *; do
|
||||
echo "$file"
|
||||
done
|
||||
|
||||
# or
|
||||
# or
|
||||
|
||||
for file in *
|
||||
do
|
||||
echo "$file"
|
||||
done
|
||||
```
|
||||
|
||||
### Rationale:
|
||||
|
||||
ShellCheck 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.
|
||||
@@ -30,7 +31,7 @@ ShellCheck found a `do` on the same line as a loop, but `do` only starts a loop
|
||||
|
||||
If you wanted to treat `do` as a literal string, you can quote it to make this clear to ShellCheck and humans:
|
||||
|
||||
```
|
||||
```sh
|
||||
for f in "for" "do" "done"
|
||||
do
|
||||
echo "Shell keywords include: $f"
|
||||
|
Reference in New Issue
Block a user