From b7ffa9e9bfbd4496377acb4c551f749a1bccd054 Mon Sep 17 00:00:00 2001 From: jkhsjdhjs Date: Fri, 22 Mar 2019 18:45:57 +0100 Subject: [PATCH] cache_uname: change reading variables from 'SystemVersion.plist' as suggested in review --- neofetch | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/neofetch b/neofetch index 1063a950..ff5b551d 100755 --- a/neofetch +++ b/neofetch @@ -4201,14 +4201,13 @@ cache_uname() { if [[ "$kernel_name" == "Darwin" ]]; then IFS=$'\n' read -d "" -ra sw_vers < <(awk -F'<|>' '/key|string/ {print $3}' \ "/System/Library/CoreServices/SystemVersion.plist") - for i in "${!sw_vers[@]}"; do - local value="${sw_vers[(( $i + 1 ))]}" - case "${sw_vers[$i]}" in - "ProductName") darwin_name="$value" ;; - "ProductVersion") osx_version="$value" ;; - "ProductBuildVersion") osx_build="$value" ;; + for ((i=0;i<${#sw_vers[@]};i+=2)) { + case ${sw_vers[i]} in + ProductName) darwin_name=${sw_vers[i+1]} ;; + ProductVersion) osx_version=${sw_vers[i+1]} ;; + ProductBuildVersion) osx_build=${sw_vers[i+1]} ;; esac - done + } fi }