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 #!/bin/sh
usage () { usage () {
echo 'usage: kvmstats.sh [-u M|G]' echo 'usage: kvmstats.sh [-u K|M|G]'
exit 1 exit 1
} }
POW=$(echo 1024 ^ 1 | bc) POW=$(echo 1024 ^ 3 | bc)
while echo $1 | grep -q '^-[[:alnum:]]' while echo $1 | grep -q '^-[[:alnum:]]'
do do
case $1 in case $1 in
'-u') '-u')
case $2 in case $2 in
'K')
POW=$(echo 1024 ^ 1 | bc)
;;
'M') 'M')
POW=$(echo 1024 ^ 2 | bc) POW=$(echo 1024 ^ 2 | bc)
;; ;;