Use GiB as default unit for memory

As a result, K arg has been added to -u option to
see memory in KiB.
This commit is contained in:
Alexis Ben Miloud--Josselin 2018-06-08 12:08:31 +02:00
parent 80ba982841
commit ee4750cefa

View file

@ -1,16 +1,19 @@
#!/bin/sh
usage () {
echo 'usage: kvmstats.sh [-u M|G]'
echo 'usage: kvmstats.sh [-u K|M|G]'
exit 1
}
POW=$(echo 1024 ^ 1 | bc)
POW=$(echo 1024 ^ 3 | bc)
while echo $1 | grep -q '^-[[:alnum:]]'
do
case $1 in
'-u')
case $2 in
'K')
POW=$(echo 1024 ^ 1 | bc)
;;
'M')
POW=$(echo 1024 ^ 2 | bc)
;;