1From 39b6eec51f0c2fa5f2b0e876b14dcfc9c1febf97 Mon Sep 17 00:00:00 2001 2From: Nicolas Boichat <drinkcat@google.com> 3Date: Fri, 4 Aug 2023 12:55:36 +0000 4Subject: [PATCH] Detect which awk to use 5 6Some embedded distributions (e.g. buildroot) may only provide mawk, 7without a symlink to awk. 8 9At first glance, awk scripts to appear to work fine with either 10gawk or mawk. 11 12Signed-off-by: Nicolas Boichat <drinkcat@google.com> 13Upstream: https://github.com/KittyKatt/screenFetch/commit/b49a2334b8ba806dbc532219e86363886a85d9c8 14[rebased on 3.9.1] 15--- 16 screenfetch-dev | 245 +++++++++++++++++++++++++----------------------- 17 1 file changed, 130 insertions(+), 115 deletions(-) 18 19diff --git a/screenfetch-dev b/screenfetch-dev 20index 1e53b2c..765930f 100755 21--- a/screenfetch-dev 22+++ b/screenfetch-dev 23@@ -352,9 +352,9 @@ colorNumberToCode () { 24 25 detectColors () { 26 my_colors=$(sed 's/^,/na,/;s/,$/,na/;s/,/ /' <<< "${OPTARG}") 27- my_lcolor=$(awk -F' ' '{print $1}' <<< "${my_colors}") 28+ my_lcolor=$("${AWK}" -F' ' '{print $1}' <<< "${my_colors}") 29 my_lcolor=$(colorNumberToCode "${my_lcolor}") 30- my_hcolor=$(awk -F' ' '{print $2}' <<< "${my_colors}") 31+ my_hcolor=$("${AWK}" -F' ' '{print $2}' <<< "${my_colors}") 32 my_hcolor=$(colorNumberToCode "${my_hcolor}") 33 } 34 35@@ -462,7 +462,22 @@ case $1 in 36 --version) displayVersion; exit 0;; 37 esac 38 39+# Detect which awk to use (unless already specified in environment) 40+if [[ -z "${AWK}" ]]; then 41+ for awk in awk gawk mawk; do 42+ if command -v "${awk}" > /dev/null; then 43+ AWK="${awk}" 44+ break 45+ fi 46+ done 47+fi 48+ 49+if ! command -v "${AWK}" > /dev/null; then 50+ errorOut "No awk interpreter available (AWK=\"${AWK}\")." 51+ exit 1 52+fi 53 54+# Parse the rest of the flags (some of these functions require awk) 55 while getopts ":hsu:evVEnLNtlS:A:D:o:c:d:pa:w" flags; do 56 case $flags in 57 h) displayHelp; exit 0 ;; 58@@ -608,8 +623,8 @@ detectdistro () { 59 "Debian") 60 if [[ -f /etc/crunchbang-lsb-release || -f /etc/lsb-release-crunchbang ]]; then 61 distro="CrunchBang" 62- distro_release=$(awk -F'=' '/^DISTRIB_RELEASE=/ {print $2}' /etc/lsb-release-crunchbang) 63- distro_codename=$(awk -F'=' '/^DISTRIB_DESCRIPTION=/ {print $2}' /etc/lsb-release-crunchbang) 64+ distro_release=$("${AWK}" -F'=' '/^DISTRIB_RELEASE=/ {print $2}' /etc/lsb-release-crunchbang) 65+ distro_codename=$("${AWK}" -F'=' '/^DISTRIB_DESCRIPTION=/ {print $2}' /etc/lsb-release-crunchbang) 66 elif [[ -f /etc/siduction-version ]]; then 67 distro="Siduction" 68 distro_release="(Debian Sid)" 69@@ -620,10 +635,10 @@ detectdistro () { 70 elif [[ -f /etc/os-release ]]; then 71 if grep -q -i 'Raspbian' /etc/os-release ; then 72 distro="Raspbian" 73- distro_release=$(awk -F'=' '/^PRETTY_NAME=/ {print $2}' /etc/os-release) 74+ distro_release=$("${AWK}" -F'=' '/^PRETTY_NAME=/ {print $2}' /etc/os-release) 75 elif grep -q -i 'BlankOn' /etc/os-release ; then 76 distro='BlankOn' 77- distro_release=$(awk -F'=' '/^PRETTY_NAME=/ {print $2}' /etc/os-release) 78+ distro_release=$("${AWK}" -F'=' '/^PRETTY_NAME=/ {print $2}' /etc/os-release) 79 else 80 distro="Debian" 81 fi 82@@ -639,7 +654,7 @@ detectdistro () { 83 ;; 84 "Sulin") 85 distro="Sulin" 86- distro_release=$(awk -F'=' '/^ID_LIKE=/ {print $2}' /etc/os-release) 87+ distro_release=$("${AWK}" -F'=' '/^ID_LIKE=/ {print $2}' /etc/os-release) 88 distro_codename="Roolling donkey" # this is not wrong :D 89 ;; 90 "KaOS"|"kaos") 91@@ -718,7 +733,7 @@ detectdistro () { 92 if grep -q 'SailfishOS' /etc/os-release; then 93 distro="SailfishOS" 94 distro_codename="$(grep 'VERSION=' /etc/os-release | cut -d '(' -f2 | cut -d ')' -f1)" 95- distro_release="$(awk -F'=' '/^VERSION=/ {print $2}' /etc/os-release)" 96+ distro_release="$("${AWK}" -F'=' '/^VERSION=/ {print $2}' /etc/os-release)" 97 fi 98 fi 99 ;; 100@@ -753,7 +768,7 @@ detectdistro () { 101 if grep -q -i 'SUSE Linux Enterprise' /etc/os-release ; then 102 distro="SUSE Linux Enterprise" 103 distro_codename="n/a" 104- distro_release=$(awk -F'=' '/^VERSION_ID=/ {print $2}' /etc/os-release | tr -d '"') 105+ distro_release=$("${AWK}" -F'=' '/^VERSION_ID=/ {print $2}' /etc/os-release | tr -d '"') 106 fi 107 fi 108 if [[ "${distro_codename}" == "Tumbleweed" ]]; then 109@@ -789,7 +804,7 @@ detectdistro () { 110 distro="SailfishOS" 111 if [[ -f /etc/os-release ]]; then 112 distro_codename="$(grep 'VERSION=' /etc/os-release | cut -d '(' -f2 | cut -d ')' -f1)" 113- distro_release="$(awk -F'=' '/^VERSION=/ {print $2}' /etc/os-release)" 114+ distro_release="$("${AWK}" -F'=' '/^VERSION=/ {print $2}' /etc/os-release)" 115 fi 116 ;; 117 "Sparky"|"SparkyLinux") 118@@ -863,12 +878,12 @@ detectdistro () { 119 ;; 120 "Haiku") 121 distro="Haiku" 122- distro_more="$(uname -v | awk '/^hrev/ {print $1}')" 123+ distro_more="$(uname -v | "${AWK}" '/^hrev/ {print $1}')" 124 ;; 125 "GNU/Linux") 126 if type -p crux >/dev/null 2>&1; then 127 distro="CRUX" 128- distro_more="$(crux | awk '{print $3}')" 129+ distro_more="$(crux | "${AWK}" '{print $3}')" 130 fi 131 if type -p nixos-version >/dev/null 2>&1; then 132 distro="NixOS" 133@@ -944,7 +959,7 @@ detectdistro () { 134 [[ "${distro}" == "Neon" ]] && distro="KDE neon" 135 [[ "${distro}" == "SLED" || "${distro}" == "sled" || "${distro}" == "SLES" || "${distro}" == "sles" ]] && distro="SUSE Linux Enterprise" 136 if [[ "${distro}" == "SUSE Linux Enterprise" && -f /etc/os-release ]]; then 137- distro_more="$(awk -F'=' '/^VERSION_ID=/ {print $2}' /etc/os-release | tr -d '"')" 138+ distro_more="$("${AWK}" -F'=' '/^VERSION_ID=/ {print $2}' /etc/os-release | tr -d '"')" 139 fi 140 if [[ "${distro}" == "Debian" && -f /usr/bin/pveversion ]]; then 141 distro="Proxmox VE" 142@@ -955,7 +970,7 @@ detectdistro () { 143 144 if [[ "${distro}" == "Unknown" && "${OSTYPE}" =~ "linux" && -f /etc/lsb-release ]]; then 145 LSB_RELEASE=$(</etc/lsb-release) 146- distro=$(echo "${LSB_RELEASE}" | awk 'BEGIN { 147+ distro=$(echo "${LSB_RELEASE}" | "${AWK}" 'BEGIN { 148 distro = "Unknown" 149 } 150 { 151@@ -1001,7 +1016,7 @@ detectdistro () { 152 if [ -f /etc/os-release ]; then 153 if grep -q -i 'SUSE Linux Enterprise' /etc/os-release ; then 154 distro="SUSE Linux Enterprise" 155- distro_more=$(awk -F'=' '/^VERSION_ID=/ {print $2}' /etc/os-release | tr -d '"') 156+ distro_more=$("${AWK}" -F'=' '/^VERSION_ID=/ {print $2}' /etc/os-release | tr -d '"') 157 fi 158 fi 159 if [[ "${distro_more}" =~ "Tumbleweed" ]]; then 160@@ -1051,7 +1066,7 @@ detectdistro () { 161 if [[ -x /usr/bin/sw_vers ]] && /usr/bin/sw_vers | grep -i 'Mac OS X' >/dev/null; then 162 distro="Mac OS X" 163 elif [[ -f /var/run/dmesg.boot ]]; then 164- distro=$(awk 'BEGIN { 165+ distro=$("${AWK}" 'BEGIN { 166 distro = "Unknown" 167 } 168 { 169@@ -1080,7 +1095,7 @@ detectdistro () { 170 171 if [[ "${distro}" == "Unknown" ]] && [[ "${OSTYPE}" =~ "linux" || "${OSTYPE}" == "gnu" ]]; then 172 if [[ -f /etc/issue ]]; then 173- distro=$(awk 'BEGIN { 174+ distro=$("${AWK}" 'BEGIN { 175 distro = "Unknown" 176 } 177 { 178@@ -1123,8 +1138,8 @@ detectdistro () { 179 fi 180 elif [[ -f /etc/lsb-release ]]; then 181 if grep -q -i 'CHROMEOS_RELEASE_NAME' /etc/lsb-release; then 182- distro="$(awk -F'=' '/^CHROMEOS_RELEASE_NAME=/ {print $2}' /etc/lsb-release)" 183- distro_more="$(awk -F'=' '/^CHROMEOS_RELEASE_VERSION=/ {print $2}' /etc/lsb-release)" 184+ distro="$("${AWK}" -F'=' '/^CHROMEOS_RELEASE_NAME=/ {print $2}' /etc/lsb-release)" 185+ distro_more="$("${AWK}" -F'=' '/^CHROMEOS_RELEASE_VERSION=/ {print $2}' /etc/lsb-release)" 186 fi 187 fi 188 fi 189@@ -1301,7 +1316,7 @@ detectuptime () { 190 now=$(date +%s) 191 uptime=$((now - boot)) 192 elif [[ "${distro}" == "Haiku" ]]; then 193- uptime=$(uptime | awk -F', up ' '{gsub(/ *hours?,/, "h"); gsub(/ *minutes?/, "m"); print $2;}') 194+ uptime=$(uptime | "${AWK}" -F', up ' '{gsub(/ *hours?,/, "h"); gsub(/ *minutes?/, "m"); print $2;}') 195 else 196 if [[ -f /proc/uptime ]]; then 197 uptime=$(</proc/uptime) 198@@ -1322,9 +1337,9 @@ detectuptime () { 199 fi 200 else 201 if [[ "$distro" =~ "NetBSD" ]]; then 202- uptime=$(awk -F. '{print $1}' /proc/uptime) 203+ uptime=$("${AWK}" -F. '{print $1}' /proc/uptime) 204 elif [[ "$distro" =~ "BSD" ]]; then 205- uptime=$(uptime | awk '{$1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; sub(" days","d");sub(",","");sub(":","h ");sub(",","m"); print}') 206+ uptime=$(uptime | "${AWK}" '{$1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; sub(" days","d");sub(",","");sub(":","h ");sub(",","m"); print}') 207 fi 208 fi 209 verboseOut "Finding current uptime...found as '${uptime}'" 210@@ -1483,21 +1498,21 @@ detectcpu () { 211 cpu="Unknown" 212 fi 213 elif [ "$distro" == "FreeBSD" ]; then 214- cpu=$(dmesg | awk -F': ' '/^CPU/ {gsub(/ +/," "); gsub(/\([^\(\)]*\)|CPU /,"", $2); print $2; exit}') 215+ cpu=$(dmesg | "${AWK}" -F': ' '/^CPU/ {gsub(/ +/," "); gsub(/\([^\(\)]*\)|CPU /,"", $2); print $2; exit}') 216 elif [ "$distro" == "DragonFlyBSD" ]; then 217 cpu=$(sysctl -n hw.model) 218 elif [ "$distro" == "OpenBSD" ]; then 219 cpu=$(sysctl -n hw.model | sed 's/@.*//') 220 elif [ "$distro" == "Haiku" ]; then 221- cpu=$(sysinfo -cpu | awk -F': ' '/^CPU #0/ {gsub(/ +/," "); gsub(/\([^\(\)]*\)|CPU /,"", $2); print $2; exit}') 222+ cpu=$(sysinfo -cpu | "${AWK}" -F': ' '/^CPU #0/ {gsub(/ +/," "); gsub(/\([^\(\)]*\)|CPU /,"", $2); print $2; exit}') 223 else 224- cpu=$(awk -F':' '/^model name/ {split($2, A, " @"); print A[1]; exit}' /proc/cpuinfo) 225+ cpu=$("${AWK}" -F':' '/^model name/ {split($2, A, " @"); print A[1]; exit}' /proc/cpuinfo) 226 cpun=$(grep -c '^processor' /proc/cpuinfo) 227 if [ -z "$cpu" ]; then 228- cpu=$(awk 'BEGIN{FS=":"} /Hardware/ { print $2; exit }' /proc/cpuinfo) 229+ cpu=$("${AWK}" 'BEGIN{FS=":"} /Hardware/ { print $2; exit }' /proc/cpuinfo) 230 fi 231 if [ -z "$cpu" ]; then 232- cpu=$(awk 'BEGIN{FS=":"} /^cpu/ { gsub(/ +/," ",$2); print $2; exit}' /proc/cpuinfo | sed 's/, altivec supported//;s/^ //') 233+ cpu=$("${AWK}" 'BEGIN{FS=":"} /^cpu/ { gsub(/ +/," ",$2); print $2; exit}' /proc/cpuinfo | sed 's/, altivec supported//;s/^ //') 234 if [[ $cpu =~ ^(PPC)*9.+ ]]; then 235 model="IBM PowerPC G5 " 236 elif [[ $cpu =~ 740/750 ]]; then 237@@ -1541,15 +1556,15 @@ detectcpu () { 238 bl="${loc}/bios_limit" 239 smf="${loc}/scaling_max_freq" 240 if [ -f "$bl" ] && [ -r "$bl" ]; then 241- cpu_mhz=$(awk '{print $1/1000}' "$bl") 242+ cpu_mhz=$("${AWK}" '{print $1/1000}' "$bl") 243 elif [ -f "$smf" ] && [ -r "$smf" ]; then 244- cpu_mhz=$(awk '{print $1/1000}' "$smf") 245+ cpu_mhz=$("${AWK}" '{print $1/1000}' "$smf") 246 else 247- cpu_mhz=$(awk -F':' '/cpu MHz/{ print int($2+.5) }' /proc/cpuinfo | head -n 1) 248+ cpu_mhz=$("${AWK}" -F':' '/cpu MHz/{ print int($2+.5) }' /proc/cpuinfo | head -n 1) 249 fi 250 if [ -n "$cpu_mhz" ]; then 251 if [ "${cpu_mhz%.*}" -ge 1000 ]; then 252- cpu_ghz=$(awk '{print $1/1000}' <<< "${cpu_mhz}") 253+ cpu_ghz=$("${AWK}" '{print $1/1000}' <<< "${cpu_mhz}") 254 cpufreq="${cpu_ghz}GHz" 255 else 256 cpufreq="${cpu_mhz}MHz" 257@@ -1603,16 +1618,16 @@ detectgpu () { 258 # gpu=$(sed 's/.*device.*= //' <<< "${gpu_info}" | sed "s/'//g") 259 fi 260 elif [[ "${distro}" == "OpenBSD" ]]; then 261- gpu=$(glxinfo 2> /dev/null | awk '/OpenGL renderer string/ { sub(/OpenGL renderer string: /,""); print }') 262+ gpu=$(glxinfo 2> /dev/null | "${AWK}" '/OpenGL renderer string/ { sub(/OpenGL renderer string: /,""); print }') 263 elif [[ "${distro}" == "Mac OS X" ]]; then 264- gpu=$(system_profiler SPDisplaysDataType | awk -F': ' '/^ *Chipset Model:/ {print $2}' | awk '{ printf "%s / ", $0 }' | sed -e 's/\/ $//g') 265+ gpu=$(system_profiler SPDisplaysDataType | "${AWK}" -F': ' '/^ *Chipset Model:/ {print $2}' | "${AWK}" '{ printf "%s / ", $0 }' | sed -e 's/\/ $//g') 266 elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then 267 gpu=$(wmic path Win32_VideoController get caption | sed -n '2p') 268 elif [[ "${distro}" == "Haiku" ]]; then 269- gpu="$(listdev | grep -A2 -e 'device Display controller' | awk -F': ' '/^ +device/ {print $2}')" 270+ gpu="$(listdev | grep -A2 -e 'device Display controller' | "${AWK}" -F': ' '/^ +device/ {print $2}')" 271 else 272 if [[ -n "$(PATH="/opt/bin:$PATH" type -p nvidia-smi)" ]]; then 273- gpu=$($(PATH="/opt/bin:$PATH" type -p nvidia-smi | cut -f1) -q | awk -F':' '/Product Name/ {gsub(/: /,":"); print $2}' | sed ':a;N;$!ba;s/\n/, /g') 274+ gpu=$($(PATH="/opt/bin:$PATH" type -p nvidia-smi | cut -f1) -q | "${AWK}" -F':' '/Product Name/ {gsub(/: /,":"); print $2}' | sed ':a;N;$!ba;s/\n/, /g') 275 elif [[ -n "$(PATH="/usr/sbin:$PATH" type -p glxinfo)" && -z "${gpu}" ]]; then 276 gpu_info=$($(PATH="/usr/sbin:$PATH" type -p glxinfo | cut -f1) 2>/dev/null) 277 gpu=$(grep "OpenGL renderer string" <<< "${gpu_info}" | cut -d ':' -f2 | sed -n -e '1h;2,$H;${g;s/\n/, /g' -e 'p' -e '}') 278@@ -1650,12 +1665,12 @@ detectgpu () { 279 # Run it only on Intel Processors if GPU is unknown 280 DetectIntelGPU() { 281 if [ -r /proc/fb ]; then 282- gpu=$(awk 'BEGIN {ORS = " &"} {$1="";print}' /proc/fb | sed -r s/'^\s+|\s*&$'//g) 283+ gpu=$("${AWK}" 'BEGIN {ORS = " &"} {$1="";print}' /proc/fb | sed -r s/'^\s+|\s*&$'//g) 284 fi 285 286 case $gpu in 287 *mfb) 288- gpu=$(lspci | grep -i vga | awk -F ": " '{print $2}') 289+ gpu=$(lspci | grep -i vga | "${AWK}" -F ": " '{print $2}') 290 ;; 291 *intel*) 292 gpu="intel" 293@@ -1667,7 +1682,7 @@ DetectIntelGPU() { 294 295 if [[ "$gpu" = "intel" ]]; then 296 #Detect CPU 297- local CPU=$(uname -p | awk '{print $3}') 298+ local CPU=$(uname -p | "${AWK}" '{print $3}') 299 CPU=${CPU#*'-'}; #Detect CPU number 300 301 #Detect Intel GPU 302@@ -1710,7 +1725,7 @@ detectdisk () { 303 if [[ "${distro}" =~ (Free|Net|DragonFly)BSD ]]; then 304 totaldisk=$(df -h -c 2>/dev/null | tail -1) 305 elif [[ "${distro}" == "OpenBSD" ]]; then 306- totaldisk=$(df -Pk 2> /dev/null | awk ' 307+ totaldisk=$(df -Pk 2> /dev/null | "${AWK}" ' 308 /^\// {total+=$2; used+=$3; avail+=$4} 309 END{printf("total %.1fG %.1fG %.1fG %d%%\n", total/1048576, used/1048576, avail/1048576, used*100/total)}') 310 elif [[ "${distro}" == "Mac OS X" ]]; then 311@@ -1718,9 +1733,9 @@ detectdisk () { 312 else 313 totaldisk=$(df -h -x aufs -x tmpfs -x overlay --total 2>/dev/null | tail -1) 314 fi 315- disktotal=$(awk '{print $2}' <<< "${totaldisk}") 316- diskused=$(awk '{print $3}' <<< "${totaldisk}") 317- diskusedper=$(awk '{print $5}' <<< "${totaldisk}") 318+ disktotal=$("${AWK}" '{print $2}' <<< "${totaldisk}") 319+ diskused=$("${AWK}" '{print $3}' <<< "${totaldisk}") 320+ diskusedper=$("${AWK}" '{print $5}' <<< "${totaldisk}") 321 diskusage="${diskused} / ${disktotal} (${diskusedper})" 322 diskusage_verbose=$(sed 's/%/%%/' <<< "$diskusage") 323 fi 324@@ -1733,17 +1748,17 @@ detectdisk () { 325 detectmem () { 326 if [ "$distro" == "Mac OS X" ]; then 327 totalmem=$(echo "$(sysctl -n hw.memsize)" / 1024^2 | bc) 328- wiredmem=$(vm_stat | grep wired | awk '{ print $4 }' | sed 's/\.//') 329- activemem=$(vm_stat | grep ' active' | awk '{ print $3 }' | sed 's/\.//') 330- compressedmem=$(vm_stat | grep occupied | awk '{ print $5 }' | sed 's/\.//') 331+ wiredmem=$(vm_stat | grep wired | "${AWK}" '{ print $4 }' | sed 's/\.//') 332+ activemem=$(vm_stat | grep ' active' | "${AWK}" '{ print $3 }' | sed 's/\.//') 333+ compressedmem=$(vm_stat | grep occupied | "${AWK}" '{ print $5 }' | sed 's/\.//') 334 if [[ ! -z "$compressedmem | tr -d" ]]; then # FIXME: is this line correct? 335 compressedmem=0 336 fi 337 usedmem=$(((wiredmem + activemem + compressedmem) * 4 / 1024)) 338 elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then 339- total_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) 340+ total_mem=$("${AWK}" '/MemTotal/ { print $2 }' /proc/meminfo) 341 totalmem=$((total_mem / 1024)) 342- free_mem=$(awk '/MemFree/ { print $2 }' /proc/meminfo) 343+ free_mem=$("${AWK}" '/MemFree/ { print $2 }' /proc/meminfo) 344 used_mem=$((total_mem - free_mem)) 345 usedmem=$((used_mem / 1024)) 346 elif [[ "$distro" == "FreeBSD" || "$distro" == "DragonFlyBSD" ]]; then 347@@ -1769,21 +1784,21 @@ detectmem () { 348 usedmem=$((used_mem / 1024 / 1024)) 349 elif [ "$distro" == "OpenBSD" ]; then 350 totalmem=$(($(sysctl -n hw.physmem) / 1024 / 1024)) 351- usedmem=$(vmstat | awk '!/[a-z]/{gsub("M",""); print $3}') 352+ usedmem=$(vmstat | "${AWK}" '!/[a-z]/{gsub("M",""); print $3}') 353 elif [ "$distro" == "NetBSD" ]; then 354- phys_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) 355+ phys_mem=$("${AWK}" '/MemTotal/ { print $2 }' /proc/meminfo) 356 totalmem=$((phys_mem / 1024)) 357 if grep -q 'Cached' /proc/meminfo; then 358- cache=$(awk '/Cached/ {print $2}' /proc/meminfo) 359+ cache=$("${AWK}" '/Cached/ {print $2}' /proc/meminfo) 360 usedmem=$((cache / 1024)) 361 else 362- free_mem=$(awk '/MemFree/ { print $2 }' /proc/meminfo) 363+ free_mem=$("${AWK}" '/MemFree/ { print $2 }' /proc/meminfo) 364 used_mem=$((phys_mem - free_mem)) 365 usedmem=$((used_mem / 1024)) 366 fi 367 elif [ "$distro" == "Haiku" ]; then 368- totalmem=$(sysinfo -mem | awk 'NR == 1 {gsub(/[\(\)\/]/, ""); printf("%d", $6/1024**2)}') 369- usedmem=$(sysinfo -mem | awk 'NR == 1 {gsub(/[\(\)\/]/, ""); printf("%d", $5/1024**2)}') 370+ totalmem=$(sysinfo -mem | "${AWK}" 'NR == 1 {gsub(/[\(\)\/]/, ""); printf("%d", $6/1024**2)}') 371+ usedmem=$(sysinfo -mem | "${AWK}" 'NR == 1 {gsub(/[\(\)\/]/, ""); printf("%d", $5/1024**2)}') 372 else 373 # MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable 374 # Source: https://github.com/dylanaraps/neofetch/pull/391/files#diff-e863270127ca6116fd30e708cdc582fc 375@@ -1798,7 +1813,7 @@ detectmem () { 376 #done 377 #usedmem=$((usedmem / 1024)) 378 #totalmem=$((totalmem / 1024)) 379- mem=$(free -b | awk 'NR==2{print $2"-"$7}') 380+ mem=$(free -b | "${AWK}" 'NR==2{print $2"-"$7}') 381 usedmem=$((mem / 1024 / 1024)) 382 totalmem=$((${mem//-*} / 1024 / 1024)) 383 fi 384@@ -1823,7 +1838,7 @@ detectshell_ver () { 385 esac 386 387 if [[ -n $version_data ]];then 388- version=$(awk ' 389+ version=$("${AWK}" ' 390 BEGIN { 391 IGNORECASE=1 392 } 393@@ -1842,7 +1857,7 @@ detectshell () { 394 if [[ ! "${shell_type}" ]]; then 395 if [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" || "${distro}" == "Haiku" || "${distro}" == "Alpine Linux" || 396 "${distro}" == "Mac OS X" || "${distro}" == "TinyCore" || "${distro}" == "Raspbian" || "${OSTYPE}" == "gnu" ]]; then 397- shell_type=$(echo "$SHELL" | awk -F'/' '{print $NF}') 398+ shell_type=$(echo "$SHELL" | "${AWK}" -F'/' '{print $NF}') 399 elif readlink -f "$SHELL" 2>&1 | grep -q -i 'busybox'; then 400 shell_type="BusyBox" 401 else 402@@ -1851,7 +1866,7 @@ detectshell () { 403 elif [[ "${distro}" =~ "BSD" ]]; then 404 shell_type=$(ps -p $PPID -o command | tail -1) 405 else 406- shell_type=$(ps -p "$(ps -p $PPID | awk '$1 !~ /PID/ {print $1}')" | awk 'FNR>1 {print $1}') 407+ shell_type=$(ps -p "$(ps -p $PPID | "${AWK}" '$1 !~ /PID/ {print $1}')" | "${AWK}" 'FNR>1 {print $1}') 408 fi 409 shell_type=${shell_type/-} 410 shell_type=${shell_type//*\/} 411@@ -1881,7 +1896,7 @@ detectshell () { 412 shell_version_data=$( detectshell_ver "$shell_type" "^zsh" "2" ) 413 ;; 414 fish) 415- shell_version_data=$( fish --version | awk '{print $3}' ) 416+ shell_version_data=$( fish --version | "${AWK}" '{print $3}' ) 417 ;; 418 esac 419 420@@ -1899,17 +1914,17 @@ detectshell () { 421 detectres () { 422 xResolution="No X Server" 423 if [[ ${distro} == "Mac OS X" ]]; then 424- xResolution=$(system_profiler SPDisplaysDataType | awk '/Resolution:/ {print $2"x"$4" "}') 425+ xResolution=$(system_profiler SPDisplaysDataType | "${AWK}" '/Resolution:/ {print $2"x"$4" "}') 426 if [[ "$(echo "$xResolution" | wc -l)" -ge 1 ]]; then 427 xResolution=$(echo "$xResolution" | tr "\\n" "," | sed 's/\(.*\),/\1/') 428 fi 429 elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then 430- xResolution=$(wmic path Win32_VideoController get CurrentHorizontalResolution,CurrentVerticalResolution | awk 'NR==2 {print $1"x"$2}') 431+ xResolution=$(wmic path Win32_VideoController get CurrentHorizontalResolution,CurrentVerticalResolution | "${AWK}" 'NR==2 {print $1"x"$2}') 432 elif [[ "${distro}" == "Haiku" ]]; then 433- xResolution="$(screenmode | grep Resolution | awk '{gsub(/,/,""); print $2"x"$3}')" 434+ xResolution="$(screenmode | grep Resolution | "${AWK}" '{gsub(/,/,""); print $2"x"$3}')" 435 elif [[ -n ${DISPLAY} ]]; then 436 if type -p xdpyinfo >/dev/null 2>&1; then 437- xResolution=$(xdpyinfo | awk '/^ +dimensions/ {print $2}') 438+ xResolution=$(xdpyinfo | "${AWK}" '/^ +dimensions/ {print $2}') 439 fi 440 fi 441 verboseOut "Finding current resolution(s)...found as '$xResolution'" 442@@ -1937,7 +1952,7 @@ detectde () { 443 if type -p xprop >/dev/null 2>&1;then 444 xprop_root="$(xprop -root 2>/dev/null)" 445 if [[ -n ${xprop_root} ]]; then 446- DE=$(echo "${xprop_root}" | awk 'BEGIN { 447+ DE=$(echo "${xprop_root}" | "${AWK}" 'BEGIN { 448 de = "Not Present" 449 } 450 { 451@@ -2099,7 +2114,7 @@ detectde () { 452 elif [[ ${KDE_FULL_SESSION} == 'true' ]]; then 453 DE="KDE" 454 DEver_data=$(kded --version 2>/dev/null) 455- DEver=$(grep -si '^KDE:' <<< "$DEver_data" | awk '{print $2}') 456+ DEver=$(grep -si '^KDE:' <<< "$DEver_data" | "${AWK}" '{print $2}') 457 fi 458 fi 459 fi 460@@ -2154,7 +2169,7 @@ detectde () { 461 fi 462 elif [[ ${DE} == "LXQt" ]]; then 463 if type -p lxqt-about >/dev/null 2>&1; then 464- DEver=$(lxqt-about --version | awk '/^liblxqt/ {print $2}') 465+ DEver=$(lxqt-about --version | "${AWK}" '/^liblxqt/ {print $2}') 466 DE="${DE} ${DEver}" 467 fi 468 elif [[ ${DE} == "MATE" ]]; then 469@@ -2169,12 +2184,12 @@ detectde () { 470 fi 471 elif [[ ${DE} == "Deepin" ]]; then 472 if [[ -f /etc/deepin-version ]]; then 473- DEver="$(awk -F '=' '/Version/ {print $2}' /etc/deepin-version)" 474+ DEver="$("${AWK}" -F '=' '/Version/ {print $2}' /etc/deepin-version)" 475 DE="${DE} ${DEver//* }" 476 fi 477 elif [[ ${DE} == "Trinity" ]]; then 478 if type -p tde-config >/dev/null 2>&1; then 479- DEver="$(tde-config --version | awk -F ' ' '/TDE:/ {print $2}')" 480+ DEver="$(tde-config --version | "${AWK}" -F ' ' '/TDE:/ {print $2}')" 481 DE="${DE} ${DEver//* }" 482 fi 483 fi 484@@ -2418,7 +2433,7 @@ detectwmtheme () { 485 else 486 themeFile="$(reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Themes' /v 'CurrentTheme')" 487 fi 488- Win_theme=$(echo "$themeFile" | awk -F"\\" '{print $NF}' | sed 's|\.theme$||') 489+ Win_theme=$(echo "$themeFile" | "${AWK}" -F"\\" '{print $NF}' | sed 's|\.theme$||') 490 fi 491 else 492 case $WM in 493@@ -2433,7 +2448,7 @@ detectwmtheme () { 494 ;; 495 'BlackBox') 496 if [ -f "$HOME/.blackboxrc" ]; then 497- Win_theme="$(awk -F"/" '/styleFile/ {print $NF}' "$HOME/.blackboxrc")" 498+ Win_theme="$("${AWK}" -F"/" '/styleFile/ {print $NF}' "$HOME/.blackboxrc")" 499 fi 500 ;; 501 'BudgieWM') 502@@ -2465,11 +2480,11 @@ detectwmtheme () { 503 fi 504 ;; 505 'E16') 506- Win_theme="$(awk -F"= " '/theme.name/ {print $2}' "$HOME/.e16/e_config--0.0.cfg")" 507+ Win_theme="$("${AWK}" -F"= " '/theme.name/ {print $2}' "$HOME/.e16/e_config--0.0.cfg")" 508 ;; 509 'E17'|'Enlightenment') 510 if [ "$(which eet 2>/dev/null)" ]; then 511- econfig="$(eet -d "$HOME/.e/e/config/standard/e.cfg" config | awk '/value \"file\" string.*.edj/{ print $4 }')" 512+ econfig="$(eet -d "$HOME/.e/e/config/standard/e.cfg" config | "${AWK}" '/value \"file\" string.*.edj/{ print $4 }')" 513 econfigend="${econfig##*/}" 514 Win_theme=${econfigend%.*} 515 elif [ -n "${E_CONF_PROFILE}" ]; then 516@@ -2485,12 +2500,12 @@ detectwmtheme () { 517 ;; 518 'FluxBox'|'Fluxbox') 519 if [ -f "$HOME/.fluxbox/init" ]; then 520- Win_theme="$(awk -F"/" '/styleFile/ {print $NF}' "$HOME/.fluxbox/init")" 521+ Win_theme="$("${AWK}" -F"/" '/styleFile/ {print $NF}' "$HOME/.fluxbox/init")" 522 fi 523 ;; 524 'IceWM') 525 if [ -f "$HOME/.icewm/theme" ]; then 526- Win_theme="$(awk -F"[\",/]" '!/#/ {print $2}' "$HOME/.icewm/theme")" 527+ Win_theme="$("${AWK}" -F"[\",/]" '!/#/ {print $2}' "$HOME/.icewm/theme")" 528 fi 529 ;; 530 'KWin'*) 531@@ -2507,14 +2522,14 @@ detectwmtheme () { 532 Win_theme="Not Applicable" 533 KDE_CONFIG_DIR=${KDE_CONFIG_DIR%/} 534 if [[ -f $KDE_CONFIG_DIR/share/config/kwinrc ]]; then 535- Win_theme="$(awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0); print $0; exit}' "$KDE_CONFIG_DIR/share/config/kwinrc")" 536+ Win_theme="$("${AWK}" '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0); print $0; exit}' "$KDE_CONFIG_DIR/share/config/kwinrc")" 537 if [[ -z "$Win_theme" ]]; then 538 Win_theme="Not Applicable" 539 fi 540 fi 541 if [[ "$Win_theme" == "Not Applicable" ]]; then 542 if [[ -f $KDE_CONFIG_DIR/share/config/kdebugrc ]]; then 543- Win_theme="$(awk '/(decoration)/ {gsub(/\[/,"",$1); print $1; exit}' "$KDE_CONFIG_DIR/share/config/kdebugrc")" 544+ Win_theme="$("${AWK}" '/(decoration)/ {gsub(/\[/,"",$1); print $1; exit}' "$KDE_CONFIG_DIR/share/config/kdebugrc")" 545 if [[ -z "$Win_theme" ]]; then 546 Win_theme="Not Applicable" 547 fi 548@@ -2522,7 +2537,7 @@ detectwmtheme () { 549 fi 550 if [[ "$Win_theme" == "Not Applicable" ]]; then 551 if [[ -f $KDE_CONFIG_DIR/share/config/kdeglobals ]]; then 552- Win_theme="$(awk '/\[General\]/ {flag=1;next} /^$/{flag=0} flag {print}' "$KDE_CONFIG_DIR/share/config/kdeglobals" | grep -oP 'Name=\K.*')" 553+ Win_theme="$("${AWK}" '/\[General\]/ {flag=1;next} /^$/{flag=0} flag {print}' "$KDE_CONFIG_DIR/share/config/kdeglobals" | grep -oP 'Name=\K.*')" 554 if [[ -z "$Win_theme" ]]; then 555 Win_theme="Not Applicable" 556 fi 557@@ -2552,20 +2567,20 @@ detectwmtheme () { 558 ;; 559 'OpenBox'|'Openbox') 560 if [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/rc.xml" ]; then 561- Win_theme="$(awk -F"[<,>]" '/<theme/ { getline; print $3 }' "${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/rc.xml")"; 562+ Win_theme="$("${AWK}" -F"[<,>]" '/<theme/ { getline; print $3 }' "${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/rc.xml")"; 563 elif [[ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/lxde-rc.xml && "${DE}" == "LXDE" ]]; then 564- Win_theme="$(awk -F"[<,>]" '/<theme/ { getline; print $3 }' "${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/lxde-rc.xml")"; 565+ Win_theme="$("${AWK}" -F"[<,>]" '/<theme/ { getline; print $3 }' "${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/lxde-rc.xml")"; 566 elif [[ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/lxqt-rc.xml && "${DE}" =~ "LXQt" ]]; then 567- Win_theme="$(awk -F'=' '/^theme/ {print $2}' ${HOME}/.config/lxqt/lxqt.conf)" 568+ Win_theme="$("${AWK}" -F'=' '/^theme/ {print $2}' ${HOME}/.config/lxqt/lxqt.conf)" 569 fi 570 ;; 571 'PekWM') 572 if [ -f "$HOME/.pekwm/config" ]; then 573- Win_theme="$(awk -F"/" '/Theme/ {gsub(/\"/,""); print $NF}' "$HOME/.pekwm/config")" 574+ Win_theme="$("${AWK}" -F"/" '/Theme/ {gsub(/\"/,""); print $NF}' "$HOME/.pekwm/config")" 575 fi 576 ;; 577 'Sawfish') 578- Win_theme="$(awk -F")" '/\(quote default-frame-style/{print $2}' "$HOME/.sawfish/custom" | sed 's/ (quote //')" 579+ Win_theme="$("${AWK}" -F")" '/\(quote default-frame-style/{print $2}' "$HOME/.sawfish/custom" | sed 's/ (quote //')" 580 ;; 581 'TWin') 582 if [[ -z $TDE_CONFIG_DIR ]]; then 583@@ -2576,7 +2591,7 @@ detectwmtheme () { 584 if [[ -n $TDE_CONFIG_DIR ]]; then 585 TDE_CONFIG_DIR=${TDE_CONFIG_DIR%/} 586 if [[ -f $TDE_CONFIG_DIR/share/config/kcmthememanagerrc ]]; then 587- Win_theme=$(awk '/CurrentTheme=/ {gsub(/CurrentTheme=/,"",$0); print $0; exit}' "$TDE_CONFIG_DIR/share/config/kcmthememanagerrc") 588+ Win_theme=$("${AWK}" '/CurrentTheme=/ {gsub(/CurrentTheme=/,"",$0); print $0; exit}' "$TDE_CONFIG_DIR/share/config/kcmthememanagerrc") 589 fi 590 if [[ -z $Win_theme ]]; then 591 Win_theme="Not Applicable" 592@@ -2672,31 +2687,31 @@ detectgtk () { 593 594 if [[ -n ${KDE_CONFIG_FILE} ]]; then 595 if grep -q 'widgetStyle=' "${KDE_CONFIG_FILE}"; then 596- gtk2Theme=$(awk -F"=" '/widgetStyle=/ {print $2}' "${KDE_CONFIG_FILE}") 597+ gtk2Theme=$("${AWK}" -F"=" '/widgetStyle=/ {print $2}' "${KDE_CONFIG_FILE}") 598 elif grep -q 'colorScheme=' "${KDE_CONFIG_FILE}"; then 599- gtk2Theme=$(awk -F"=" '/colorScheme=/ {print $2}' "${KDE_CONFIG_FILE}") 600+ gtk2Theme=$("${AWK}" -F"=" '/colorScheme=/ {print $2}' "${KDE_CONFIG_FILE}") 601 fi 602 603 if grep -q 'Theme=' "${KDE_CONFIG_FILE}"; then 604- gtkIcons=$(awk -F"=" '/Theme=/ {print $2}' "${KDE_CONFIG_FILE}") 605+ gtkIcons=$("${AWK}" -F"=" '/Theme=/ {print $2}' "${KDE_CONFIG_FILE}") 606 fi 607 608 if grep -q 'Font=' "${KDE_CONFIG_FILE}"; then 609- gtkFont=$(awk -F"=" '/font=/ {print $2}' "${KDE_CONFIG_FILE}") 610+ gtkFont=$("${AWK}" -F"=" '/font=/ {print $2}' "${KDE_CONFIG_FILE}") 611 fi 612 fi 613 614 if [[ -f $HOME/.gtkrc-2.0 ]]; then 615- gtk2Theme=$(grep '^gtk-theme-name' "$HOME"/.gtkrc-2.0 | awk -F'=' '{print $2}') 616+ gtk2Theme=$(grep '^gtk-theme-name' "$HOME"/.gtkrc-2.0 | "${AWK}" -F'=' '{print $2}') 617 gtk2Theme=${gtk2Theme//\"/} 618- gtkIcons=$(grep '^gtk-icon-theme-name' "$HOME"/.gtkrc-2.0 | awk -F'=' '{print $2}') 619+ gtkIcons=$(grep '^gtk-icon-theme-name' "$HOME"/.gtkrc-2.0 | "${AWK}" -F'=' '{print $2}') 620 gtkIcons=${gtkIcons//\"/} 621- gtkFont=$(grep 'font_name' "$HOME"/.gtkrc-2.0 | awk -F'=' '{print $2}') 622+ gtkFont=$(grep 'font_name' "$HOME"/.gtkrc-2.0 | "${AWK}" -F'=' '{print $2}') 623 gtkFont=${gtkFont//\"/} 624 fi 625 626 if [[ -f $HOME/.config/gtk-3.0/settings.ini ]]; then 627- gtk3Theme=$(grep '^gtk-theme-name=' "$HOME"/.config/gtk-3.0/settings.ini | awk -F'=' '{print $2}') 628+ gtk3Theme=$(grep '^gtk-theme-name=' "$HOME"/.config/gtk-3.0/settings.ini | "${AWK}" -F'=' '{print $2}') 629 fi 630 ;; 631 'Cinnamon'*) # Desktop Environment found as "Cinnamon" 632@@ -2728,7 +2743,7 @@ detectgtk () { 633 gtkFont=$(gconftool-2 -g /desktop/gnome/interface/font_name) 634 if [ "$background_detect" == "1" ]; then 635 gtkBackgroundFull=$(gconftool-2 -g /desktop/gnome/background/picture_filename) 636- gtkBackground=$(echo "$gtkBackgroundFull" | awk -F"/" '{print $NF}') 637+ gtkBackground=$(echo "$gtkBackgroundFull" | "${AWK}" -F"/" '{print $NF}') 638 fi 639 fi 640 ;; 641@@ -2745,10 +2760,10 @@ detectgtk () { 642 ;; 643 'Xfce'*) # Desktop Environment found as "Xfce" 644 if [ "$distro" == "BunsenLabs" ] ; then 645- gtk2Theme=$(awk -F'"' '/^gtk-theme/ {print $2}' "$HOME"/.gtkrc-2.0) 646- gtk3Theme=$(awk -F'=' '/^gtk-theme-name/ {print $2}' "$HOME"/.config/gtk-3.0/settings.ini) 647- gtkIcons=$(awk -F'"' '/^gtk-icon-theme/ {print $2}' "$HOME"/.gtkrc-2.0) 648- gtkFont=$(awk -F'"' '/^gtk-font-name/ {print $2}' "$HOME"/.gtkrc-2.0) 649+ gtk2Theme=$("${AWK}" -F'"' '/^gtk-theme/ {print $2}' "$HOME"/.gtkrc-2.0) 650+ gtk3Theme=$("${AWK}" -F'=' '/^gtk-theme-name/ {print $2}' "$HOME"/.config/gtk-3.0/settings.ini) 651+ gtkIcons=$("${AWK}" -F'"' '/^gtk-icon-theme/ {print $2}' "$HOME"/.gtkrc-2.0) 652+ gtkFont=$("${AWK}" -F'"' '/^gtk-font-name/ {print $2}' "$HOME"/.gtkrc-2.0) 653 else 654 if type -p xfconf-query >/dev/null 2>&1; then 655 gtk2Theme=$(xfconf-query -c xsettings -p /Net/ThemeName 2>/dev/null) 656@@ -2779,15 +2794,15 @@ detectgtk () { 657 fi 658 659 if grep -q 'sNet\/ThemeName' "${config_home}${lxdeconf}" 2>/dev/null; then 660- gtk2Theme=$(awk -F'=' '/sNet\/ThemeName/ {print $2}' "${config_home}${lxdeconf}") 661+ gtk2Theme=$("${AWK}" -F'=' '/sNet\/ThemeName/ {print $2}' "${config_home}${lxdeconf}") 662 fi 663 664 if grep -q 'IconThemeName' "${config_home}${lxdeconf}" 2>/dev/null; then 665- gtkIcons=$(awk -F'=' '/sNet\/IconThemeName/ {print $2}' "${config_home}${lxdeconf}") 666+ gtkIcons=$("${AWK}" -F'=' '/sNet\/IconThemeName/ {print $2}' "${config_home}${lxdeconf}") 667 fi 668 669 if grep -q 'FontName' "${config_home}${lxdeconf}" 2>/dev/null; then 670- gtkFont=$(awk -F'=' '/sGtk\/FontName/ {print $2}' "${config_home}${lxdeconf}") 671+ gtkFont=$("${AWK}" -F'=' '/sGtk\/FontName/ {print $2}' "${config_home}${lxdeconf}") 672 fi 673 ;; 674 675@@ -2796,15 +2811,15 @@ detectgtk () { 676 *) # Lightweight or No DE Found 677 if [ -f "$HOME/.gtkrc-2.0" ]; then 678 if grep -q 'gtk-theme' "$HOME/.gtkrc-2.0"; then 679- gtk2Theme=$(awk -F'"' '/^gtk-theme/ {print $2}' "$HOME/.gtkrc-2.0") 680+ gtk2Theme=$("${AWK}" -F'"' '/^gtk-theme/ {print $2}' "$HOME/.gtkrc-2.0") 681 fi 682 683 if grep -q 'icon-theme' "$HOME/.gtkrc-2.0"; then 684- gtkIcons=$(awk -F'"' '/^gtk-icon-theme/ {print $2}' "$HOME/.gtkrc-2.0") 685+ gtkIcons=$("${AWK}" -F'"' '/^gtk-icon-theme/ {print $2}' "$HOME/.gtkrc-2.0") 686 fi 687 688 if grep -q 'font' "$HOME/.gtkrc-2.0"; then 689- gtkFont=$(awk -F'"' '/^gtk-font-name/ {print $2}' "$HOME/.gtkrc-2.0") 690+ gtkFont=$("${AWK}" -F'"' '/^gtk-font-name/ {print $2}' "$HOME/.gtkrc-2.0") 691 fi 692 fi 693 # $HOME/.gtkrc.mine theme detect only 694@@ -2815,37 +2830,37 @@ detectgtk () { 695 fi 696 if [ -f "$minegtkrc" ]; then 697 if grep -q '^include' "$minegtkrc"; then 698- gtk2Theme=$(grep '^include.*gtkrc' "$minegtkrc" | awk -F "/" '{ print $5 }') 699+ gtk2Theme=$(grep '^include.*gtkrc' "$minegtkrc" | "${AWK}" -F "/" '{ print $5 }') 700 fi 701 if grep -q '^gtk-icon-theme-name' "$minegtkrc"; then 702- gtkIcons=$(grep '^gtk-icon-theme-name' "$minegtkrc" | awk -F '"' '{print $2}') 703+ gtkIcons=$(grep '^gtk-icon-theme-name' "$minegtkrc" | "${AWK}" -F '"' '{print $2}') 704 fi 705 fi 706 # /etc/gtk-2.0/gtkrc compatibility 707 if [[ -f /etc/gtk-2.0/gtkrc && ! -f "$HOME/.gtkrc-2.0" && ! -f "$HOME/.gtkrc.mine" && ! -f "$HOME/.gtkrc-2.0.mine" ]]; then 708 if grep -q 'gtk-theme-name' /etc/gtk-2.0/gtkrc; then 709- gtk2Theme=$(awk -F'"' '/^gtk-theme-name/ {print $2}' /etc/gtk-2.0/gtkrc) 710+ gtk2Theme=$("${AWK}" -F'"' '/^gtk-theme-name/ {print $2}' /etc/gtk-2.0/gtkrc) 711 fi 712 if grep -q 'gtk-fallback-theme-name' /etc/gtk-2.0/gtkrc && ! [ "x$gtk2Theme" = "x" ]; then 713- gtk2Theme=$(awk -F'"' '/^gtk-fallback-theme-name/ {print $2}' /etc/gtk-2.0/gtkrc) 714+ gtk2Theme=$("${AWK}" -F'"' '/^gtk-fallback-theme-name/ {print $2}' /etc/gtk-2.0/gtkrc) 715 fi 716 717 if grep -q 'icon-theme' /etc/gtk-2.0/gtkrc; then 718- gtkIcons=$(awk -F'"' '/^icon-theme/ {print $2}' /etc/gtk-2.0/gtkrc) 719+ gtkIcons=$("${AWK}" -F'"' '/^icon-theme/ {print $2}' /etc/gtk-2.0/gtkrc) 720 fi 721 if grep -q 'gtk-fallback-icon-theme' /etc/gtk-2.0/gtkrc && ! [ "x$gtkIcons" = "x" ]; then 722- gtkIcons=$(awk -F'"' '/^gtk-fallback-icon-theme/ {print $2}' /etc/gtk-2.0/gtkrc) 723+ gtkIcons=$("${AWK}" -F'"' '/^gtk-fallback-icon-theme/ {print $2}' /etc/gtk-2.0/gtkrc) 724 fi 725 726 if grep -q 'font' /etc/gtk-2.0/gtkrc; then 727- gtkFont=$(awk -F'"' '/^gtk-font-name/ {print $2}' /etc/gtk-2.0/gtkrc) 728+ gtkFont=$("${AWK}" -F'"' '/^gtk-font-name/ {print $2}' /etc/gtk-2.0/gtkrc) 729 fi 730 fi 731 732 # EXPERIMENTAL gtk3 Theme detection 733 if [[ "$gtk3Theme" = "Not Found" && -f "$HOME/.config/gtk-3.0/settings.ini" ]]; then 734 if grep -q 'gtk-theme-name' "$HOME/.config/gtk-3.0/settings.ini"; then 735- gtk3Theme=$(awk -F'=' '/^gtk-theme-name/ {print $2}' "$HOME/.config/gtk-3.0/settings.ini") 736+ gtk3Theme=$("${AWK}" -F'=' '/^gtk-theme-name/ {print $2}' "$HOME/.config/gtk-3.0/settings.ini") 737 fi 738 fi 739 740@@ -2859,7 +2874,7 @@ detectgtk () { 741 742 # ROX-Filer icon detect only 743 if [ -a "${XDG_CONFIG_HOME:-${HOME}/.config}/rox.sourceforge.net/ROX-Filer/Options" ]; then 744- gtkIcons=$(awk -F'[>,<]' '/icon_theme/ {print $3}' "${XDG_CONFIG_HOME:-${HOME}/.config}/rox.sourceforge.net/ROX-Filer/Options") 745+ gtkIcons=$("${AWK}" -F'[>,<]' '/icon_theme/ {print $3}' "${XDG_CONFIG_HOME:-${HOME}/.config}/rox.sourceforge.net/ROX-Filer/Options") 746 fi 747 748 # E17 detection 749@@ -2872,10 +2887,10 @@ detectgtk () { 750 # Background Detection (feh, nitrogen) 751 if [ "$background_detect" == "1" ]; then 752 if [ -a "$HOME/.fehbg" ]; then 753- gtkBackgroundFull=$(awk -F"'" '/feh --bg/{print $2}' "$HOME/.fehbg" 2>/dev/null) 754- gtkBackground=$(echo "$gtkBackgroundFull" | awk -F"/" '{print $NF}') 755+ gtkBackgroundFull=$("${AWK}" -F"'" '/feh --bg/{print $2}' "$HOME/.fehbg" 2>/dev/null) 756+ gtkBackground=$(echo "$gtkBackgroundFull" | "${AWK}" -F"/" '{print $NF}') 757 elif [ -a "${XDG_CONFIG_HOME:-${HOME}/.config}/nitrogen/bg-saved.cfg" ]; then 758- gtkBackground=$(awk -F"/" '/file=/ {print $NF}' "${XDG_CONFIG_HOME:-${HOME}/.config}/nitrogen/bg-saved.cfg") 759+ gtkBackground=$("${AWK}" -F"/" '/file=/ {print $NF}' "${XDG_CONFIG_HOME:-${HOME}/.config}/nitrogen/bg-saved.cfg") 760 fi 761 fi 762 763@@ -2910,7 +2925,7 @@ detectdroid () { 764 rom=$(getprop ro.build.display.id) 765 fi 766 baseband=$(getprop ro.baseband) 767- cpu=$(awk -F': ' '/^Processor/ {P=$2} /^Hardware/ {H=$2} END {print H != "" ? H : P}' /proc/cpuinfo) 768+ cpu=$("${AWK}" -F': ' '/^Processor/ {P=$2} /^Hardware/ {H=$2} END {print H != "" ? H : P}' /proc/cpuinfo) 769 } 770 771 772@@ -6032,7 +6047,7 @@ asciiText () { 773 #n=${#fulloutput[*]} 774 for ((i=0; i<${#fulloutput[*]}; i++)); do 775 # echo "${out_array[@]}" 776- case $(awk 'BEGIN{srand();print int(rand()*(1000-1))+1 }') in 777+ case $("${AWK}" 'BEGIN{srand();print int(rand()*(1000-1))+1 }') in 778 411|188|15|166|609) 779 f_size=${#fulloutput[*]} 780 o_size=${#out_array[*]} 781-- 7822.41.0.640.ga95def55d0-goog 783 784