#!/usr/bin/env bash echoerr() { echo -e "$@" 1>&2; } check_is_installed() { local __name="$1" local __extra_msg="$2" if ! is_installed "$__name"; then echo "FATAL: Missing requirement '$__name'" echo "Please install $__name before running this script." if [[ -n $__extra_msg ]]; then echo "" echo "$__extra_msg" echo "" fi exit 1 fi } is_installed() { local __name="$1" if $(which $__name >/dev/null 2>&1); then return 0 else return 1 fi }