Skip to content

mmichaelis/lib-bash

Repository files navigation

lib-bash – Bash Libraries GitHub Release

GitHub License GitHub Pages

Lib-Bash Decorative Image

A set of libraries to use from within your Bash scripts.

Table of Contents

Library Usage Pattern

All libraries are meant to embedded in a similar way. The following applies best practices according to spellcheck:

MY_PATH="$(realpath "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "${MY_PATH}")"
readonly MY_PATH
readonly SCRIPT_DIR
readonly LIB_BASH_DIR="${SCRIPT_DIR}/lib_bash"
source "${LIB_BASH_DIR}/lib_<name>.sh"

Overview of Libraries

For details, visit the GitHub Pages.

lib_console

Utility functions for console output, similar to general logging requirements. Also, containing a specialized cat command supporting colored output.

lib_gnucompat

Utility functions and dynamically defined constants for scripts preferring (or requiring) GNU compatible tooling. Meant especially for systems such as MacOS, to prefer GNU-Tools like coreutils by preferring prefixed tools like gsed, gawk.

lib_init

Apply general recommended strictness settings for Bash scripts. Includes support for DEBUG environment variable at two stages: 1 enables debug logging, while 2 (or above) triggers script debugging.

lib_scriptinfo

Functions to provide information about your script.

Installation

GitHub Downloads (all assets, latest release)

Find below two possible installation scenarios, assuming, that you want to use this libraries from your own Git managed repository.

As an alternative, you may just download the archives containing the minimal set of files.

Git Submodules

git submodule add https://github.com/mmichaelis/lib-bash.git lib-bash
git submodule update --init --recursive

Git Subtrees

# Add Subtree
git subtree add --prefix=lib-bash \
  https://github.com/mmichaelis/lib-bash.git main --squash
# Update Subtree
git subtree pull --prefix=lib-bash \
  https://github.com/mmichaelis/lib-bash.git main --squash

GitHub Pages

Build Locally

To build the GitHub Pages locally, follow these steps:

cd docs
bundle install
bundle exec jekyll serve --source ./ --destination ../_site

Regarding supported plugins, see:

Kudos

This would not exist without help, including GitHub Copilot.

Other tools and applications, that helped me:

About

Library Files for Use in Bash Scripts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages