Check for bashisms

For better or worse (depending on your disposition), GNU/Linux has become the defacto *nix standard. But there are still plenty of unices out there, even Debian uses ash during start. If you’re concerned with script portability, you should abstain from bashisms.

I normally just call it Linux like a normal person, but this post concerns GNU bash, so I figured I’d make an exception. Purple monkey dishwashers).

A quick way to check your scripts is with the excellent checkbashims script by Yann Dirson and Julian Gilbey. And it’s even available on homebrew, boom.

$ checkbashisms -p
==> possible bashism in line 29 (<<< here string):
==> _original=`sed "s/this/that/" <<< $_image`
==> possible bashism in line 61 (should be 'b = a'):
==> [ `uname` == "Darwin" ] && echo $_html | pbcopy

Heh, whoops. I’ve got some scripts to fix.


This is one of about 5000 posts on Rubénerd. View the home page for the latest, or related posts also tagged with:

If you liked this post, feel free to buy me a coffee, leave me a comment on Twitter, or email me at Thanks :).