Bashisms
A while back I spent quite a bit of time writing Korn Shell scripts, but it was a while back. The last few years it’s been all Bash for me, in fact these days I try to write everything in Python.
Anyway that means that just now trying to write a POSIX Shell script has proved a little challenging.
The manual is rather long and wordy, although it seems like it’s all there. There’s the Shell Command Language, although things you think of as being part of the shell don’t seem to be – ie. “test”, which implements the “[” in “if [ x = y ]”, that’s separate.
Despite a bit of googling I couldn’t find a good list of bashisms and their POSIX replacements, there’s a few mentioned here. I did find the next better thing, a script that checks for you, “checkbashisms”, it’s in the Debian devscripts package.
And if you’re running Ubuntu you can switch to using /bin/dash for your script temporarily, if it runs under dash it’s probably pretty safe. Let’s be honest most people use bash anyway 🙂
If anyone does have a good list of bashisms I’d love to see it.
Posted by mike on Tuesday April 22nd, 2008, tagged with linux, plau, pltc
And people who don’t like bash are bascist language nazis!
As Ubuntu gets more common, which has dash as the default, a lot of users will switch.
A lot of users will scratch their heads as things silently break for them …