bash is terse, esoteric and full of gotchas. You should never use it like a proper programming language. But...
... there are times when you do. For example, bash is installed pretty much everywhere, is fast to write (when you've mastered it), decent at managing tasks, etc.
Here is a collection of snippets and functions that I have created or gathered over the years. To use these, I generally copy and paste them into a script I am writing.
See bash.md.
make
To run tests:
make test