Blogmark

When in doubt, be consistent

via jbranchaud@gmail.com

https://google.github.io/styleguide/shellguide.html
Software Development Bash Style Guide

Using one style consistently through our codebase lets us focus on other (more important) issues. Consistency also allows for automation. In many cases, rules that are attributed to “Be Consistent” boil down to “Just pick one and stop worrying about it”; the potential value of allowing flexibility on these points is outweighed by the cost of having people argue over them.

Lots of great tips in this style guide on writing good bash scripts.

Other good (general) advice:

When assessing the complexity of your code (e.g. to decide whether to switch languages) consider whether the code is easily maintainable by people other than its author.