Non-code building blocks for BASH scripts.
This repository contains files that hold comments, declarations or other common
non-code lines often used in (my) BASH scripts. Instead of copy/pasting these
lines, this repository offers a way of installing them as a dependecy (using
BPKG). They can then be included from BASH scripts using source
.
They are meant to serve as building blocks for BASH scripts.
This repository can be installed in several ways:
- Using
bpkg
- Cloning the repository
- Downloading the archive for a given release
Available as a bpkg package:
bpkg install 'potherca-bash/includes'
This will install all available files in the deps/
directory of the project
that bpkg
has been run in.
git clone '[email protected]:potherca-bash/includes.git'
The latest release will always be tagged latests
. To download the latest archive:
curl -L -o 'includes.tar.gz' 'https://github.com/potherca-bash/includes/archive/latest.tar.gz'
tar -xvzf 'includes.tar.gz'
Simply include a file using source
:
#!/usr/bin/env bash
source './deps/includes/src/declare/declare.bash-options.inc'
source './deps/includes/src/comment/license/comment.license-gpl3.inc'
source './deps/includes/src/declare/declare.color.inc'
source './deps/includes/src/declare/declare.exit-codes.inc'
# ...
# Script logic goes here
# ...
This works best when used during development, for production it is advisable to
compile a version from the script that replaces the source
entries with the
content of the included file(s).
To make code changes, fork this repository and install the needed dependecies:
cd './includes'
bpkg getdeps
Pull/Merge-request are welcomed.
When creating BASH script, I found myself copy/pasting certain lines of comment or code over and over. It seemed more sensible to separate those lines into separate files and just include the files from other scripts. This repository is part of that effort. Others can be found at https://github.com/potherca-bash/.
- Author: Created by Potherca.
- License: Licensed under the GPL-3.0 License (GNU General Public License v3.0)
- Website: https://github.com/potherca-bash/includes