Shell Standard Library
Supported bash versions currently include the following though not all functions will be supported on all versions.
- 3.2.57
- 4.0.44
- 4.1.17
- 4.2.53
- 4.3.48
- 4.4.23
- 5.0-beta
Support for bash 3.1 has bene deprecated.
For an example of how to install/import see:
import_install_example.sh
Variables/Options which can be set/exported to change the behaviour of the library and various functions during execution.
interactive
- true/false - en/dis-ables interactive promps and features requiring a TTY/PTYstrict_mode
- true/false - en/dis-ables shell options to stop and/or exit on errors and undefined variablesverbosity
- 0-10 - Sets the verbosity for debug logging, default 0
For testing bash code across multiple versions of bash we highly recommend using the bashtester submodule, you can pull it with this repository by using:
git clone --recurse-submodules https://github.com/sdelements/shtdlib.git
Or if you've already cloned this project you can initialize and pull using:
git submodule init
git submodule update --recursive
-
all supported versions (using docker containers)
source shtdlib.sh && test_shtdlib
-
local bash only, no containers
source shtdlib.sh && test_shtdlib local
-
specific bash version(s) and/or local
source shtdlib.sh && test_shtdlib 3.2.57 4.4.23 local