Friday, February 10, 2023

bash script strategies

 I did a fair amount of bash scripting for a recent project to provide support for managing an ecosystem of docker containers, java applications, and javascript server, including some low-level utility scripts that are shared by higher-level scripts. 

In the process, I realized that it would be helpful to develop and follow some rules and patterns because otherwise it would be easy to have different solutions to the same problem in different places in code that is already difficult to read and understand. 

To that end, I decided to create a document on the project wiki to describe my current thinking and approach on various aspects of bash script development (portability, defining variables, command substitution, passing and receiving parameters between scripts, testing conditions, checking results of commands, console output, ...) so that I can refer back to it and extend it when I have similar work to do in the future.

No comments: