#4 analyze shell scripts with shellcheck

Closed
opened 4 years ago by renken · 1 comments
renken commented 4 years ago

quoting from man spellcheck

ShellCheck is a static analysis and linting tool for sh/bash scripts. It's mainly focused on handling typical beginner and intermediate level syntax errors and pitfalls where the shell just gives a cryptic error message or strange behavior, but it also reports on a few more advanced issues where corner cases can cause delayed failures.

sample

$ shellcheck new 

In new line 14:
read title
^-- SC2162: read without -r will mangle backslashes.


In new line 17:
    read title
        ^-- SC2162: read without -r will mangle backslashes.


In new line 23:
    if [ -f $file ]; then
            ^-- SC2086: Double quote to prevent globbing and word splitting.
quoting from `man spellcheck` > ShellCheck is a static analysis and linting tool for sh/bash scripts. It's mainly focused on handling typical beginner and intermediate level syntax errors and pitfalls where the shell just gives a cryptic error message or strange behavior, but it also reports on a few more advanced issues where corner cases can cause delayed failures. sample ```sh $ shellcheck new In new line 14: read title ^-- SC2162: read without -r will mangle backslashes. In new line 17: read title ^-- SC2162: read without -r will mangle backslashes. In new line 23: if [ -f $file ]; then ^-- SC2086: Double quote to prevent globbing and word splitting. ```
nokoru commented 4 years ago
Owner

syntax corrected. thank you!

syntax corrected. thank you!
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.