#!/usr/bin/env bash # # Check whether Python is installed. # # Usage: check_python # # VARIABLES # # Find python: PYTHON=$(command -v python 2>/dev/null) # FUNCTIONS # # Prints usage information. usage() { echo '' >&2 echo 'Usage: check_python' >&2 echo '' >&2 } # MAIN # if [[ -x "${PYTHON}" ]] && "${PYTHON}" --version >/dev/null; then echo 'Python is installed.' >&2 exit 0 else echo 'ERROR: missing dependency. Please download Python version 2.7 (https://www.python.org/). Once installed, run the command again.' >&2 exit 1 fi # TODO: check for minimum version