bash-boost is a set of library functions for bash, useful for both scripting and interactive use. It draws inspiration from the Boost C++ libraries.
- Prefer pure-bash solutions
- Don't reimplement existing bash features, complement them
- Functions should have a single purpose, without complicated options
- Avoid cluttering the user's environment
For examples and further details, see CONTRIBUTING.md
bash
version 4.2 or later.
This has only been tested for Linux. YMMV for other platforms.
Download and run the interactive bootstrap script to install the latest release. The script will allow you to enter a directory of your choice or you can select from prepopulated locations.
bash <(curl -sSL tomocafe.github.io/bash-boost/bootstrap.sh)
You can rerun this at any time to update an exsting installation.
Download and extract the latest release, then follow the instructions in the Usage section.
Clone this repository and run make
. For manpage generation, perl
and pandoc
are required.
Source the bash-boost.sh
script and use bb_load
to load modules and/or packages
source /path/to/bash-boost/latest/bash-boost.sh
bb_load MODULE # e.g. cli
bb_load MODULE/PKG # e.g. cli/arg
Alternatively, you can list modules and packages to load by argument when sourcing bash-boost.sh
:
source /path/to/bash-boost/latest/bash-boost.sh MODULE MODULE/PKG ...
If you want to distribute bash-boost as a single file, you can use bash-boost-portable.sh
and all modules and packages will be available for use. Please use proper attribution if distributing bash-boost. See LICENSE for details.
source /path/to/bash-boost-portable.sh
You may also want to add the included scripts and manpages to your path lists:
bb_load util/env # for bb_appendpathuniq
bb_appendpathuniq PATH "$BB_ROOT/bin"
bb_appendpathuniq MANPATH "$BB_ROOT/man"
bash-boost consists of the following modules, each with different packages
- cli - for command-line (script) use
- interactive - for interactive use
- util - general purpose routines
- env - for checking and setting environment variables
- file - file and filesystem related operations
- kwargs - for handling keyword arguments
- list - common list operations
- math - common math operations
- prof - runtime profiling routines
- string - common string operations
- time - common time and date operations
- rand - random number and string generation
You have the choice of loading an entire module, or selecting certain packages from them.
Consult the full manual for an exhaustive list of functions defined in each package.
This project follows semantic versioning. Any breaking changes must be made in a new major release. New functions are introduced in minor releases. Patch releases only include fixes to existing functions. No documented feature should be regressed in a minor or patch release.
There are a number of different bash libraries out there, including: