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!


~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert