[HN Gopher] ShellCheck: Finds bugs in your shell scripts
       ___________________________________________________________________
        
       ShellCheck: Finds bugs in your shell scripts
        
       Author : superasn
       Score  : 73 points
       Date   : 2021-05-03 20:54 UTC (2 hours ago)
        
 (HTM) web link (www.shellcheck.net)
 (TXT) w3m dump (www.shellcheck.net)
        
       | LanternLight83 wrote:
       | Some related resources, for intermediate shell users already
       | familiar with shellcheck and looking to dig deeper into the
       | history underlying obscure corner cases, include the developer
       | Vidar's blog (@ https://www.vidarholen.net/contents/blog/), the
       | blog of the Oil-Shell developer (@
       | https://www.oilshell.org/blog/), and Greg's Wiki (@
       | https://mywiki.wooledge.org/BashPitfalls).
        
       | whateveracct wrote:
       | probably one of the more widely-deployed Haskell programs
        
         | [deleted]
        
         | johnday wrote:
         | This and `pandoc` are solid proof that Haskell is a superb
         | language for processing structured text (be it for compilation,
         | or translation, or checking).
        
       | teeray wrote:
       | The best best part of Shellcheck is that the errors it produces
       | have a short code that can be looked up in their wiki. The wiki
       | explains what you did, why it's bad, and how to fix it. Using
       | Shellcheck teaches you to write better Bash, rather than just
       | yelling at you with inscrutable linter violations.
        
         | TheLocehiliosan wrote:
         | If you use iTerm2 (or I think this feature is available in
         | other terminal software) you can use "Smart Selections" to
         | transform any ShellCheck errors into links to the wiki.
         | 
         | 1. Create a Smart Selection with the regular expression "SC\d+"
         | 
         | 2. Add an action to "Open URL...", with the URL
         | "https://github.com/koalaman/shellcheck/wiki/\0" (\0 will be
         | replaced with the matched regex)
         | 
         | 3. Now holding down the command key will change any ShellCheck
         | errors to be active http links.
        
       | Tsiklon wrote:
       | I love ShellCheck. It's good at providing hints at improving your
       | style too.
        
       | mey wrote:
       | There is a convenient VS Code plugin for ShellCheck.
       | https://marketplace.visualstudio.com/items?itemName=timonwon...
        
       | fiddlerwoaroof wrote:
       | This is one of the absolutely essential tools for anyone who
       | writes a non-trivial amount of shell scripts.
        
         | nomel wrote:
         | Maybe it says something about the people I work with, but I've
         | never seen a fully valid shell script, over 20 lines long, that
         | handled spaces in paths and command errors properly, that
         | didn't first go through ShellCheck. I've noticed that hardcore
         | *nix people are usually some of the worst offenders, with their
         | phobia of spaces, from years of broken shell scripts,
         | completely preventing them from even thinking about the
         | possibility of a space in a path, with some considering the
         | space the bug, rather than its handling.
         | 
         | I've found that the best way to introduce someone to ShellCheck
         | is to run it on their script, right in front of them, with most
         | saying something like "How did I not know about this?". Linters
         | are great!
        
       | Kenji wrote:
       | I can highly recommend this tool. A few years ago, I ran it over
       | our shell scripts and it gave us many good recommendations and
       | even found some bugs. I learned a lot about shell scripting
       | during that time. Really, I cannot recommend it enough, what a
       | fantastic tool.
        
       ___________________________________________________________________
       (page generated 2021-05-03 23:00 UTC)