use 'command' built-in command instead of 'which'
This commit is contained in:
Regular → Executable
+1
-4
@@ -43,19 +43,16 @@ print_help() {
|
||||
crit=2
|
||||
fcp=0.1
|
||||
|
||||
#check required tools
|
||||
check_executable() {
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "check_executable: no parameter given!"
|
||||
exit $ST_UK
|
||||
fi
|
||||
|
||||
if [ -z "$(which $1)" ]; then
|
||||
if ! command -v "$1" &>/dev/null; then
|
||||
echo "UNKNOWN: Cannot find $1"
|
||||
exit $ST_UK
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
check_executable mysql
|
||||
|
||||
Reference in New Issue
Block a user