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