[kvmstats] add error function
continuous-integration/drone/push Build encountered an error Details

This commit is contained in:
Alexis Ben Miloud--Josselin 2019-07-26 15:48:23 +02:00
parent 501c5134d4
commit a4a7eda8e2
1 changed files with 6 additions and 5 deletions

View File

@ -2,6 +2,11 @@
set -e
error () {
echo "$0": "$@" >&2
exit 1
}
usage () {
echo 'usage: kvmstats [-a] [-u k|m|g]' >&2
exit 1
@ -9,11 +14,7 @@ usage () {
for DEP in bc virsh
do
if [ -z "$(which $DEP)" ]
then
echo "kvmstats: $DEP not found in \$PATH" >&2
exit 1
fi
command -v $DEP > /dev/null || error $DEP command not found
done
POW=$(echo 1024 ^ 3 | bc)