Overview:
The Bash Boilerplate is a collection of starter scripts designed to help users easily create safe and useful command line programs using Bash. It is ideal for creating standalone, portable, and single-file command line programs, as well as shell initialization functions. The Bash Boilerplate provides a framework approach for creating task and build files using Bask, a pure Bash mini-framework for command-centric Bash scripts.
Features:
- bash-simple: A simple bash script that includes basic strictness checks and help features. It is suitable for creating simple programs that do not have many features and do not require options other than help.
- bash-simple-plus: Similar to bash-simple, this script includes basic strictness checks and help features, with the addition of option parsing, easy debug printing, and error handling functions. It is useful for regular scripts.
- bash-subcommands: This script serves as an example of a bash program with subcommands. It includes several features that make it suitable for creating bash programs that perform multiple related tasks. It includes strict mode, help template, debug printing, option parsing, automatic subcommand loading, and a clean pattern for specifying per-subcommand help.
- functions.bash: This script contains shell function examples and boilerplate. The functions in this file are intended to be included in the interactive shell, such as defining them in a shell init file like ~/.bashrc.
- helpers.bash: This script includes helper functions primarily intended for use within scripts, but can also be adapted for shell functions.
Summary:
The Bash Boilerplate provides a collection of starter scripts for creating command line programs using Bash. It includes several key features such as strict mode, help templates, debug printing, option parsing, and subcommand loading. These scripts are useful for both simple programs and more complex programs that require multiple tasks to be performed. The included functions and helpers provide additional support for scripting and interactive shell usage. With the Bash Boilerplate, users can easily create safe and useful command line programs in Bash.