3 ms·
ShellCheck warned me of a very similar issue in a script of mine recently. In that script I ran the following: rm -rf "${FOO}/" ShellCheck helpfully warned
by kenny_r 10y ago
ShellCheck warned me of a very similar issue in a script of mine recently. In that script I ran the following:
rm -rf "${FOO}/"
ShellCheck helpfully warned me that that could have disastrous consequences when FOO is unset, instead it advised me to use this:
rm -rf "${FOO:?}/"
I'd also like to point out that ShellCheck is in the AUR for users of Arch Linux[0], and that there's a handy plugin which I use for the Atom editor[1].
[0] https://aur.archlinux.org/packages/shellcheck-git/ https://aur.archlinux.org/packages/shellcheck-git/
[1] https://atom.io/packages/linter-shellcheck https://atom.io/packages/linter-shellcheck
- andreyv 10y agoshellcheck is also in the community repo: https://www.archlinux.org/packages/community/x86_64/shellcheck/ https://www.archlinux.org/packages/community/x86_64/shellche...
- lttlrck 10y agoThere is also a plugin for sublime text [0] It doesn't take long to internalize the corrections. It's well worth using a linter if one is available. [0] https://github.com/SublimeLinter/SublimeLinter-shellcheck https://github.com/SublimeLinter/SublimeLinter-shellcheck