15 lines
324 B
Plaintext
15 lines
324 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
|
||
|
total="$(free -m | grep Mem: | awk '{ print $2 }')"
|
||
|
used="$(free -m | grep Mem: | awk '{ print $3 }')"
|
||
|
shared="$(free -m | grep Mem: | awk '{ print $5 }')"
|
||
|
free=$(expr $total - $used - $shared)
|
||
|
true_used=$(expr $shared + $used)
|
||
|
|
||
|
case $1 in
|
||
|
total) echo $total;;
|
||
|
used) echo $true_used;;
|
||
|
free) echo $free;;
|
||
|
esac
|