BASH Linting in Emacs


flycheck in emacs

It's easy to get on the fly syntax checking in Emacs (aka linting). You just two things: shellcheck and flycheck-mode.

The former is a shell command which on Debian based systems can be installed with:

# apt-get install shellcheck

The other thing you need is the Emacs plugin flycheck which can be installed in Emacs with:

M-x package-install RET flycheck

Now, you're almost all set, you just need to enable flycheck in all your shell script buffers. Adding this to your ~/.emacs should do it:

(add-hook 'sh-mode-hook 'flycheck-mode)

This should help catch loads of BASH errors and subtle bugs before even trying to run your BASH programs.

Happy hacking!


Licensed under CC BY Creative Commons License ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🐦 @torsteinkrause