use 'command' built-in command instead of 'which'

This commit is contained in:
Guillaume Coré
2018-01-19 19:00:33 +01:00
parent 5c6afec820
commit a2c3e53856
Regular → Executable
+1 -4
View File
@@ -43,19 +43,16 @@ print_help() {
crit=2 crit=2
fcp=0.1 fcp=0.1
#check required tools
check_executable() { check_executable() {
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "check_executable: no parameter given!" echo "check_executable: no parameter given!"
exit $ST_UK exit $ST_UK
fi fi
if [ -z "$(which $1)" ]; then if ! command -v "$1" &>/dev/null; then
echo "UNKNOWN: Cannot find $1" echo "UNKNOWN: Cannot find $1"
exit $ST_UK exit $ST_UK
fi fi
} }
check_executable mysql check_executable mysql