This project provides easy-to-use shell script templates for GNU Bash for users to create new scripts.
https://github.com/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template
Local debuggers need fresh livers, we made scripts more error-proof and bug-aware by bailing out whenever a potential scripting error is found.
Secure programming paradigms like Unofficial Bash Strict Mode and Defensive BASH Programming are incorporated into the template design.
We want developers to fucus on their code instead of the template's, so we moved developer related code like the init
function, print_help_message
function and process_commandline_arguments
function to the start of the script and rest of the support code at the bottom.
The template is fully versioned at the bottom of the script, which is useful to upgrade your script to new template versions for new features and fixes.
The code is documented with essential pointers for beginner to lookup with, like relevant GNU Bash manual sections, Stack Overflow answers and Bash Hackers Wiki articles.
We have incorporated the following features into the templates, so that user don't need to recreate wheels.
--help
message printing/home/username/somewhere/My Awesome Script.bash
My Awesome Script.bash
My Awesome Script
/home/username/somewhere
My Awesome Script.bash
if the script is in the executable search PATH
s (only in full variant)${0}
otherwises.Script won't broke in an exotic environment.
Supports:
The following variants are provided:
meta_util_array_shift
The code is continuously verified by ShellCheck to not containing any potential pitfalls.
Some information used to improve the project:
Software required to run the product:
For fetching script names and paths
Software required to develop the product:
For implementing script version injection
For revision management etc.
For various pre-commit hooks checking many aspects in the project and commit verification during continuous integration.
To check any potential problems in the script
Please refer the releases page for ready to use software.
GNU General Public License v3+ with an exception of only using this software as a template of a shell script(which you can use any license you prefer, attribution appreciated)
This means that GPL is enforced only when you're making another "shell script template" using this software, which you're demanded to also using GPL for your work
Similar projects that we may benefit from: