1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env sh ensure_command_exists() { _cmd=$1 _ret=0 if [ -z "${_cmd}" ]; then _execution_error error=missing_argument function=ensure_command_exists argument=cmd fi if ! which "$1" > /dev/null 2>&1; then _execution_error error=missing_dependency dependency="${_cmd}" fi }