Ready-to-use bash shell script templates at your fingertips!
https://gitlab.com/the-common/bash-script-templates
This product provides several flavors of the Bash script template to satisfy different needs:
The considered to be the bare-minimum for bash scripting:
- Shebang/Hashbang file header
- Script description and copyright declaration header
- Defensive interpreter behavior settings
Inherited from the BARE-MINIMUM flavor, but with the following additions:
- Runtime dependency detection(check whether all the required commands are available from the command search PATHs
- The following convenience variable definitions:
script
: The absolute path of the shell scriptscript_dir
: The absolute path of the directory that contains the shell scriptscript_filename
: The full filename of the shell scriptscript_name
: The name of the shellscript, excluding the filename suffixesscript_basecommand
: The base command(without arguments) when running the scriptscript_args
: An array containing all the command-line arguments when running the script
Inherited from the BASIC flavor, but with the following additions:
- The introduction of the
init
function, which enables the moving of the program's main logic to the start of the script file, increases readability. - A new
trap_err
function has being implemented to handle the ERR trap so one can immediately recognize that an error has occurred when theerrexit
interpreter behavior is triggered.
- The Common / The common GNU Bash shell script templates · GitLab
The project's main site - Issues · The Common / The common GNU Bash shell script templates · GitLab
The project's issue tracker - the-common/bash-script-templates: (MIRRORED FROM GITLAB) Ready-to-use bash shell script templates at your fingertips!
The GitHub Git repository mirror project - GNU Bash manual - GNU Project - Free Software Foundation
For references of the language and syntax used in the Bash scripts
Unless otherwise noted(individual file's header/REUSE DEP5), this product is licensed under the 4.0 International version of the Creative Commons Attribution-ShareAlike license, or any of its recent versions you would prefer, with an exception that the template is actually being used in a different kind of product(i.e. not a template), in that case feel free to use any license you prefer(an attribution to our project would be appreciated).
This work complies to the REUSE Specification, refer REUSE - Make licensing easy for everyone for info regarding the licensing of this product.