Merge pull request #596 from dylanaraps/gpu_fix
GPU: Use readarray instead of modifying IFS
This commit is contained in:
commit
31e8ebda31
1 changed files with 2 additions and 6 deletions
8
neofetch
8
neofetch
|
@ -25,9 +25,6 @@ shopt -s nocasematch
|
||||||
# Reset colors and bold.
|
# Reset colors and bold.
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
|
||||||
# Save default IFS value.
|
|
||||||
old_ifs="$IFS"
|
|
||||||
|
|
||||||
# DETECT INFORMATION
|
# DETECT INFORMATION
|
||||||
|
|
||||||
get_os() {
|
get_os() {
|
||||||
|
@ -995,9 +992,8 @@ get_cpu_usage() {
|
||||||
get_gpu() {
|
get_gpu() {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux")
|
"Linux")
|
||||||
IFS=$'\n'
|
# Read GPUs into array.
|
||||||
gpus=($(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}'))
|
readarray gpus < <(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')
|
||||||
IFS="$old_ifs"
|
|
||||||
|
|
||||||
# Number the GPUs if more than one exists.
|
# Number the GPUs if more than one exists.
|
||||||
((${#gpus[@]} > 1)) && gpu_num=1
|
((${#gpus[@]} > 1)) && gpu_num=1
|
||||||
|
|
Loading…
Reference in a new issue