Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame^] | 1 | #!/bin/sh |
2 | |||||
3 | |||||
4 | total="$(free -m | grep Mem: | awk '{ print $2 }')" | ||||
5 | used="$(free -m | grep Mem: | awk '{ print $3 }')" | ||||
6 | |||||
7 | free=$(expr $total - $used) | ||||
8 | |||||
9 | if [ "$1" = "total" ]; then | ||||
10 | echo $total | ||||
11 | elif [ "$1" = "used" ]; then | ||||
12 | echo $used | ||||
13 | elif [ "$1" = "free" ]; then | ||||
14 | echo $free | ||||
15 | fi |