More reliable whitespace removal
This commit is contained in:
parent
423af0cd48
commit
5f2047fd0b
31
neofetch
31
neofetch
|
@ -458,7 +458,6 @@ case "$os" in
|
||||||
"Linux" )
|
"Linux" )
|
||||||
if type -p lsb_release >/dev/null 2>&1; then
|
if type -p lsb_release >/dev/null 2>&1; then
|
||||||
distro="$(lsb_release -d 2>/dev/null | awk -F ':' '/Description/ {printf $2}')"
|
distro="$(lsb_release -d 2>/dev/null | awk -F ':' '/Description/ {printf $2}')"
|
||||||
distro=${distro/[[:space:]]}
|
|
||||||
|
|
||||||
elif type -p crux >/dev/null 2>&1; then
|
elif type -p crux >/dev/null 2>&1; then
|
||||||
distro="$(crux)"
|
distro="$(crux)"
|
||||||
|
@ -504,8 +503,6 @@ case "$os" in
|
||||||
|
|
||||||
# Strip crap from the output of wmic
|
# Strip crap from the output of wmic
|
||||||
distro=${distro/Caption'='}
|
distro=${distro/Caption'='}
|
||||||
distro=${distro//[[:space:]]/ }
|
|
||||||
distro=${distro// }
|
|
||||||
distro=${distro/Microsoft }
|
distro=${distro/Microsoft }
|
||||||
|
|
||||||
# Change bits to xx-bit for Windows
|
# Change bits to xx-bit for Windows
|
||||||
|
@ -513,6 +510,7 @@ case "$os" in
|
||||||
x32="32-bit"
|
x32="32-bit"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
distro=${distro//+( )/ }
|
||||||
ascii_distro="$distro"
|
ascii_distro="$distro"
|
||||||
|
|
||||||
getdistro () {
|
getdistro () {
|
||||||
|
@ -555,12 +553,10 @@ getuptime () {
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
|
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
|
||||||
uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')
|
uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')
|
||||||
uptime=${uptime/ / }
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"openSUSE"*)
|
"openSUSE"*)
|
||||||
uptime=$(uptime | awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')
|
uptime=$(uptime | awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')
|
||||||
uptime=${uptime/ / }
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -631,6 +627,7 @@ getuptime () {
|
||||||
uptime=${uptime# }
|
uptime=${uptime# }
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
uptime=${uptime//+( )/ }
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -840,7 +837,6 @@ getcpu () {
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
||||||
cpu=${cpu//+( )/ }
|
|
||||||
cores=$(sysctl -n hw.ncpu)
|
cores=$(sysctl -n hw.ncpu)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -851,8 +847,6 @@ getcpu () {
|
||||||
cpu="$(sysctl -n hw.model)"
|
cpu="$(sysctl -n hw.model)"
|
||||||
cpu=${cpu/[0-9]\.*}
|
cpu=${cpu/[0-9]\.*}
|
||||||
cpu=${cpu/ @*}
|
cpu=${cpu/ @*}
|
||||||
cpu=${cpu// }
|
|
||||||
cpu=${cpu% }
|
|
||||||
|
|
||||||
# Get cpu speed
|
# Get cpu speed
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
|
@ -868,8 +862,6 @@ getcpu () {
|
||||||
cpu="$(grep -F 'model name' /proc/cpuinfo)"
|
cpu="$(grep -F 'model name' /proc/cpuinfo)"
|
||||||
cpu=${cpu/model name*: }
|
cpu=${cpu/model name*: }
|
||||||
cpu=${cpu/ @*}
|
cpu=${cpu/ @*}
|
||||||
cpu=${cpu// }
|
|
||||||
cpu=${cpu% }
|
|
||||||
|
|
||||||
# Get cpu speed
|
# Get cpu speed
|
||||||
speed="$(grep -F 'cpu MHz' /proc/cpuinfo)"
|
speed="$(grep -F 'cpu MHz' /proc/cpuinfo)"
|
||||||
|
@ -895,11 +887,11 @@ getcpu () {
|
||||||
cpu=${cpu//(TM)}
|
cpu=${cpu//(TM)}
|
||||||
cpu=${cpu//(r)}
|
cpu=${cpu//(r)}
|
||||||
cpu=${cpu//(R)}
|
cpu=${cpu//(R)}
|
||||||
cpu=${cpu// CPU}
|
cpu=${cpu//CPU}
|
||||||
cpu=${cpu// Processor}
|
cpu=${cpu//Processor}
|
||||||
cpu=${cpu// Six-Core}
|
cpu=${cpu//Six-Core}
|
||||||
cpu=${cpu// Eight-Core}
|
cpu=${cpu//Eight-Core}
|
||||||
cpu=${cpu// with Radeon HD Graphics}
|
cpu=${cpu//with Radeon HD Graphics}
|
||||||
|
|
||||||
# Add cpu cores to output
|
# Add cpu cores to output
|
||||||
[ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \
|
[ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \
|
||||||
|
@ -927,6 +919,9 @@ getcpu () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Trim whitespace
|
||||||
|
cpu=${cpu//+( )/ }
|
||||||
|
|
||||||
# Add CPU info bar
|
# Add CPU info bar
|
||||||
prin "${subtitle}: ${cpu}"
|
prin "${subtitle}: ${cpu}"
|
||||||
|
|
||||||
|
@ -1012,7 +1007,6 @@ getgpu () {
|
||||||
|
|
||||||
nvidia*)
|
nvidia*)
|
||||||
gpu=${gpu/NVIDIA Corporation }
|
gpu=${gpu/NVIDIA Corporation }
|
||||||
gpu=${gpu/nVidia Corporation }
|
|
||||||
gpu=${gpu/G????M }
|
gpu=${gpu/G????M }
|
||||||
gpu=${gpu/G???? }
|
gpu=${gpu/G???? }
|
||||||
gpu=${gpu/\[}
|
gpu=${gpu/\[}
|
||||||
|
@ -1041,8 +1035,6 @@ getgpu () {
|
||||||
gpu=$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")
|
gpu=$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")
|
||||||
gpu=${gpu/device*= }
|
gpu=${gpu/device*= }
|
||||||
gpu=${gpu//\'}
|
gpu=${gpu//\'}
|
||||||
gpu=${gpu//[[:space:]]/ }
|
|
||||||
gpu=${gpu// }
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -1078,6 +1070,7 @@ getgpu () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
gpu=${gpu//+( )/ }
|
||||||
gpu="${gpu}${count}"
|
gpu="${gpu}${count}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1726,7 +1719,7 @@ getbirthday () {
|
||||||
|
|
||||||
# Pretty output
|
# Pretty output
|
||||||
[ "$birthday_shorthand" == "off" ] && \
|
[ "$birthday_shorthand" == "off" ] && \
|
||||||
birthday="${date_cmd/ / }"
|
birthday=${date_cmd//+( )/ }
|
||||||
|
|
||||||
# Toggle showing the time
|
# Toggle showing the time
|
||||||
[ "$birthday_time" == "off" ] && \
|
[ "$birthday_time" == "off" ] && \
|
||||||
|
|
Reference in New Issue