From aa8c6c55f6be1ea1f69b82ca5bb549e445eae519 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Apr 2018 09:40:44 +1000 Subject: [PATCH] general: Remove unsafe splitting. --- neofetch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index a9c366c8..4faac552 100755 --- a/neofetch +++ b/neofetch @@ -1510,7 +1510,8 @@ get_memory() { ;; "AIX") - mem_stat=($(svmon -G -O unit=MB)) + IFS=" " read -ra mem_stat <<< "$(svmon -G -O unit=MB)" + mem_total="${mem_stat[11]/.*}" mem_free="${mem_stat[16]/.*}" mem_used="$((mem_total - mem_free))" @@ -1518,7 +1519,9 @@ get_memory() { ;; "IRIX") - mem_stat=($(pmem | head -1)) + IFS=$'\n' read -d "" -ra mem_cmd <<< "$(pmem)" + IFS=" " read -ra mem_stat <<< "${mem_cmd[0]}" + mem_total="$((mem_stat[3] / 1024))" mem_free="$((mem_stat[5] / 1024))" mem_used="$((mem_total - mem_free))"