aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2020-03-09 22:48:23 +0200
committerDylan Araps <dylan.araps@gmail.com>2020-03-09 22:48:23 +0200
commitb2aac93208b8a93edaff96f26b8dc6c4bfb0af4d (patch)
tree398108130bc676fc5abcbb807e376ea76ff865bb
parentbe111026b19e09ece03a964ccff9c1e67dadf30a (diff)
downloadpfetch-b2aac93208b8a93edaff96f26b8dc6c4bfb0af4d.tar.gz
irix: Memory usage
-rwxr-xr-xpfetch19
1 files changed, 18 insertions, 1 deletions
diff --git a/pfetch b/pfetch
index 41f07b6..69b08b7 100755
--- a/pfetch
+++ b/pfetch
@@ -641,7 +641,24 @@ get_memory() {
;;
IRIX*)
- # TODO
+ # Read the memory information from the 'top' command. Parse
+ # and split each line until we reach the line starting with
+ # "Memory".
+ #
+ # Example output: Memory: 160M max, 147M avail, .....
+ while IFS=' :' read -r label mem_full _ mem_free _; do
+ case $label in
+ Memory)
+ mem_full=${mem_full%M}
+ mem_free=${mem_free%M}
+ break
+ ;;
+ esac
+ done <<-EOF
+ $(top -n)
+ EOF
+
+ mem_used=$((mem_full - mem_free))
;;
esac