Chapter 11. Developing Your Style Guide
The overarching theme of this book is writing idiomatic, yet readable, bash code in a consistent style, and we hope weâve provided the tools you need to do that. Style is just another way to say âhow we write things.â Find some style guidelines, write âem down, and stick to âem. Weâve covered a number of important style considerations in this book, and there are some other guidelines weâd like to mention as well, things to keep in mind when designing systems and writing code. You can use this chapter as a starting point for your own style guide or just adopt it as is if you like it. The Appendix is the same material without the talking points, to use as a âcheat sheet,â and you can get the Markdown or HTML code from this bookâs GitHub page.
Keep the following high-level principles in mind:
-
Above all: KISSâKeep It Simple, Stupid! Complexity is the enemy of security,1 but itâs also the enemy of readability and understanding. Sure, modern systems and circumstances are complex, so try hard not to make it any worse than it already is.
-
The corollary, as Brian Kernighan famously said, is that debugging is twice as hard as writing the code in the first place, so if your code is as clever as you can make it, you areâby definitionânot smart enough to debug it.
-
Try not to reinvent the wheel. Whatever you are trying to do has probably been done before, and thereâs likely a tool or library for it. If that tool is already ...
Get bash Idioms now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.