free (353B)
1 #!/bin/sh 2 3 while read -r line; do 4 case $line in 5 "real mem"*) 6 mem=${line##*\(} 7 mem=${mem%\)*} 8 mem=${mem%%B} 9 ;; 10 esac 11 done < /var/run/dmesg.boot 12 13 while read -r _ _ line _; do 14 mem_used=${line} 15 done <<-EOF 16 $(vmstat) 17 EOF 18 echo "$mem_used"/"$mem"