Check for bashisms
SoftwareFor 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 retina.sh
==> possible bashism in retina.sh line 29 (<<< here string):
==> _original=`sed "s/this/that/" <<< $_image`
==> possible bashism in retina.sh line 61 (should be 'b = a'):
==> [ `uname` == "Darwin" ] && echo $_html | pbcopy
Heh, whoops. I’ve got some scripts to fix.