Ran across this interesting blog post talking about defensive BASH scripting.
There might be some things one might not agree with, but it do contain a lot of tips for good practices. The idea behind the name “defensive” is to write code that will run into as few of a problems as possible. I for one have not been declaring readonly variables, which I think is a good thing to do.
Check it out here