From 7069410ef2cccf9ae46b33dd96fe822b7e91cd54 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 22 Dec 2016 12:47:11 +1100 Subject: [PATCH] GPU: Only number GPU if more than one exists --- neofetch | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 94ba5243..204ca0e0 100755 --- a/neofetch +++ b/neofetch @@ -968,6 +968,9 @@ get_gpu() { IFS=$'\n' gpus=($(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')) + # Number the GPUs if more than one exists. + [[ "${#gpus[@]}" > 1 ]] && index=0 + for gpu in "${gpus[@]}"; do case "$gpu" in *"advanced"*) @@ -1002,7 +1005,7 @@ get_gpu() { gpu="${gpu/Intel }" fi - prin "GPU${index:-0}" "$gpu" + prin "GPU${index}" "$gpu" index="$((index+=1))" done