tj.git-extras/check_dependencies.sh
Eli Schwartz e836b6ce4c
build: do not require the nonstandard and unpredictable 'which' utility
This may not be installed on various systems, and it's difficult to test
for the availability of the tool you need, if the check program itself
does not exist.

The POSIX 2008 specification mandates the `command -v` builtin; bash is
a POSIX 2008 compliant shell, and this builtin has worked since bash 1.x
anyway.

A side benefit of using the POSIX portable option is that it requires
neither an external disk executable, nor (because unlike "which", the
exit code is reliable) a subshell fork. This therefore represents a mild
speedup.
2019-12-12 00:13:30 -05:00

11 lines
175 B
Bash
Executable file

#!/usr/bin/env bash
err() {
echo >&2 "$1"
exit 1
}
if ! command -v column >/dev/null 2>&1; then
err "Need to install dependency 'column' before installation"
fi