Reference documentation, by its nature, can’t answer many of the important questions you might have during development:

  • Which tool is the most convenient to achieve what you want? It can be tempting to treat any Turing–complete language as a golden hammer when much more convenient alternatives exist.

  • What is the idiomatic way to achieve what you want? Developer communities will usually gravitate towards one way, or a small handful of ways of doing anything common, whether it’s how to indent code blocks or check whether a file is empty. Using these patterns makes it easier for others to understand your code, which is one of the most important characteristics of any software.

  • What are the important characteristics of this solution? Does it process one line (slow) or buffer (fast) at a time? Does it handle unusual input like newline, backslash, quotes, NUL, empty lines or non–existing paths? Is it robust in the face of third party failures?


This page is a preview of The newline Guide to Bash Scripting

No discussions yet