From 71d2d994ed6c9e70c93c3d229355867156500ed3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 5 Jan 2017 23:38:08 +1100 Subject: [PATCH] GPU: Use readarray instead of modifying IFS --- neofetch | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index 1e678ef0..cbb05f91 100755 --- a/neofetch +++ b/neofetch @@ -25,9 +25,6 @@ shopt -s nocasematch # Reset colors and bold. reset="\033[0m" -# Save default IFS value. -old_ifs="$IFS" - # DETECT INFORMATION get_os() { @@ -995,9 +992,8 @@ get_cpu_usage() { get_gpu() { case "$os" in "Linux") - IFS=$'\n' - gpus=($(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')) - IFS="$old_ifs" + # Read GPUs into array. + readarray gpus < <(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}') # Number the GPUs if more than one exists. ((${#gpus[@]} > 1)) && gpu_num=1