use 'command' built-in command instead of 'which'
This commit is contained in:
Regular → Executable
+4
-7
@@ -10,7 +10,7 @@ ST_UK=3
|
|||||||
|
|
||||||
print_version() {
|
print_version() {
|
||||||
echo "$VERSION $AUTHOR"
|
echo "$VERSION $AUTHOR"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_help() {
|
print_help() {
|
||||||
print_version $PROGNAME $VERSION
|
print_version $PROGNAME $VERSION
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user