What does HackerNews think of shellcheck?

ShellCheck, a static analysis tool for shell scripts

Language: Haskell

#10 in Bash
#6 in Haskell
#13 in Shell
shellcheck, whilst not a script itself, I do find it useful when writing them.

- https://github.com/koalaman/shellcheck

>The secret sauce is a pseudo-signal provided by bash, called EXIT, that you can trap; commands or functions trapped on it will execute when the script exits for any reason.

"Secret Sauce", why is this secret at all.

Nothing against the author who's helping the ecosystem here, but is there an authoritative guide on Bash that anyone can recommend?

Hopefully something that's portable between Mac & Linux.

The web is full of contradictory guides and shellcheck seems to be the last line of defense.

- https://github.com/koalaman/shellcheck

I throw all my shell scripts through this beast of a haskell application to see if they're clean:

https://github.com/koalaman/shellcheck

Crucially it shows where on the line the error is in case I've got some large piped one-liner which might have a problem.

Use a linter, personally pylint has helped me learn to write more "Pythonic" code. If you're using vscode, you can easily integrate it or any other python linter.

https://learn.microsoft.com/en-us/visualstudio/python/lintin...

If you also want a linter for bash, check out shellcheck: https://github.com/koalaman/shellcheck

Shellcheck https://github.com/koalaman/shellcheck : Shell scripts are unavoidable, you have to write one every now and then but shell is a terrible language with massive footguns around every corner. I don't write shell scripts extensively enough to remember all those footguns and even if I did, not sure I'd want to waste brainpower remembering all that archaic trivia.

Shellcheck makes writing shell scripts bearable and dare I say somewhat enjoyable. They have managed to collate all the shell scripting potholes and tribal knowledge into one static analysis tool. No shell script now gets checked in at work or on my personal machine without being pumped through shellcheck.

I've always just run it as a docker command. Here's what's listed on the github page [1]:

    docker run --rm -v "$PWD:/mnt" koalaman/shellcheck:stable myscript

[1] https://github.com/koalaman/shellcheck