5 ms·
Highly recommend shellcheck[1]. There is a SublimeLinter plugin[2] that automatically checks your shell scripts as you code them. It generally makes best practi
by nodesocket 8y ago
Highly recommend shellcheck[1]. There is a SublimeLinter plugin[2] that automatically checks your shell scripts as you code them. It generally makes best practice suggestions including quoting.
[1] https://github.com/koalaman/shellcheck https://github.com/koalaman/shellcheck
[2] https://github.com/SublimeLinter/SublimeLinter-shellcheck https://github.com/SublimeLinter/SublimeLinter-shellcheck
- aequitas 8y agoNot only does it make suggestions, almost all of the 'error codes' have extensive documentation on why something is wrong and often multiple alternative solutions for each use case (eg: https://github.com/koalaman/shellcheck/wiki/SC2086 https://github.com/koalaman/shellcheck/wiki/SC2086). I learned more bash from Shellcheck than all tutorials and references combined.
- freedomben 8y agoSame. I was a bit cocky when I first tried out shell check because I had been doing bash for years. Shell check flagged something I'd been using for a while and after reading the docs I realized shell check's suggestio was much cleaner and just-as-safe way to do what I was doing. Really impressive piece of software.
- __blockcipher__ 8y agoSeconding this. Shellcheck is fucking amazing and whenever I visit the wiki page for a specific issue it's extremely descriptive and helps you understand why the flagged behavior is a problem. Some of the tips are obscure stuff that I never would have realized, like using `command -v` instead of `which` in my (arch) linux install script because command -v is more portable. And then you have the classic stuff like printf instead of echo -e, using pritnf string formatting, writing `\\n` instead of `\n`, double quoting variables etc
- jwilk 8y agoI'm all for "command -v", but do you know which OSes don't have "which" by default?
- JdeBP 8y agoA straw man question. That's not the problem with which. * https://github.com/koalaman/shellcheck/wiki/SC2230 https://github.com/koalaman/shellcheck/wiki/SC2230 * https://unix.stackexchange.com/questions/85249/ https://unix.stackexchange.com/questions/85249/
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]