[kvmstats] add error function
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
501c5134d4
commit
a4a7eda8e2
11
kvmstats
11
kvmstats
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
error () {
|
||||||
|
echo "$0": "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo 'usage: kvmstats [-a] [-u k|m|g]' >&2
|
echo 'usage: kvmstats [-a] [-u k|m|g]' >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -9,11 +14,7 @@ usage () {
|
||||||
|
|
||||||
for DEP in bc virsh
|
for DEP in bc virsh
|
||||||
do
|
do
|
||||||
if [ -z "$(which $DEP)" ]
|
command -v $DEP > /dev/null || error $DEP command not found
|
||||||
then
|
|
||||||
echo "kvmstats: $DEP not found in \$PATH" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
POW=$(echo 1024 ^ 3 | bc)
|
POW=$(echo 1024 ^ 3 | bc)
|
||||||
|
|
Loading…
Reference in a new issue