POSIX-compliant shell scripting utility functions
Include shellutil.sh
as a
submodule of your Git
repo by executing the following:
$ git submodule add https://github.com/creemama/shellutil
Use the dot operator to include
shellutil.sh
in one of your scripts:
#!/bin/sh
script_dir="$(
cd "$(dirname "$0")"
pwd -P
)"
cd "$script_dir"
if [ ! -f shellutil/shellutil.sh ]; then
git submodule update --init
fi
# shellcheck source=shellutil/shellutil.sh
. shellutil/shellutil.sh
# set -o xtrace
printf '%s%s%s' "$(tbold)" 'Hello world!' "$(treset)"
is_integer
is_tty
tbold
tcyan
tgray
tgreen
tred
treset
tyellow
test_command_exists