mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Fix caps and highlight (broken) code-sample
@@ -4,15 +4,17 @@ When ShellCheck is unable to parse a file, it'll output several errors to help p
|
|||||||
|
|
||||||
Consider this script, with a missing double quote on line 1:
|
Consider this script, with a missing double quote on line 1:
|
||||||
|
|
||||||
ssh host "$cmd
|
```sh
|
||||||
echo "Finished"
|
ssh host "$cmd
|
||||||
|
echo "Finished"
|
||||||
|
```
|
||||||
|
|
||||||
Bash says:
|
Bash says:
|
||||||
|
|
||||||
file: line 2: unexpected EOF while looking for matching `"'
|
file: line 2: unexpected EOF while looking for matching `"'
|
||||||
file: line 3: syntax error: unexpected end of file
|
file: line 3: syntax error: unexpected end of file
|
||||||
|
|
||||||
Shellcheck says:
|
ShellCheck says:
|
||||||
|
|
||||||
In file line 1:
|
In file line 1:
|
||||||
ssh host "$cmd
|
ssh host "$cmd
|
||||||
@@ -29,6 +31,6 @@ Shellcheck says:
|
|||||||
1. One info showing the outer construct being parsed (SC1009)
|
1. One info showing the outer construct being parsed (SC1009)
|
||||||
1. Potentially some specific suggestions, such as when missing an `fi`.
|
1. Potentially some specific suggestions, such as when missing an `fi`.
|
||||||
|
|
||||||
Here, shellcheck says that the command on line 1 is faulty, which makes it easier to find and fix the actual problem.
|
Here, ShellCheck says that the command on line 1 is faulty, which makes it easier to find and fix the actual problem.
|
||||||
|
|
||||||
Most of ShellCheck's functionality (specifically, any checks with code >= SC2000) only applies to scripts that parse successfully, so make sure to rerun ShellCheck after fixing any syntax errors.
|
Most of ShellCheck's functionality (specifically, any checks with code >= SC2000) only applies to scripts that parse successfully, so make sure to rerun ShellCheck after fixing any syntax errors.
|
||||||
|
Reference in New Issue
Block a user