mirror of
https://github.com/eoli3n/dotfiles
synced 2024-11-22 15:01:59 +01:00
fixed wc-l
This commit is contained in:
parent
e54a7416df
commit
3c2fa7eb8b
@ -1,21 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
pacman_check() {
|
||||
pac=$(checkupdates 2>/dev/null | wc -l)
|
||||
aur=$(trizen -Qua 2>/dev/null | wc -l)
|
||||
pac=$(checkupdates 2>/dev/null)
|
||||
pac_count=$(wc -l <<< "$pac")
|
||||
aur=$(trizen -Qua 2>/dev/null)
|
||||
aur_count=$(wc -l <<< "$aur")
|
||||
|
||||
if [[ $pac -eq "0" ]] && [[ $aur -eq "0" ]] || [[ ! $pac =~ [0-9]+ ]] || [[ ! $aur =~ [0-9]+ ]]
|
||||
if [[ $pac_count -eq "0" ]] && [[ $aur_count -eq "0" ]] || [[ ! $pac_count =~ [0-9]+ ]] || [[ ! $aur_count =~ [0-9]+ ]]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if checkupdates | grep '^linux\ '
|
||||
then
|
||||
echo "$pac <span foreground='#ff5c57'></span> $aur"
|
||||
else
|
||||
#echo "$pac %{F#5b5b5b}%{F-} $aur"
|
||||
echo "$pac <span foreground='#929292'></span> $aur"
|
||||
fi
|
||||
|
||||
text="$pac <span foreground='#929292'></span> $aur"
|
||||
tooltip=$(awk -v ORS='\\n' '$0=$1' <<< "$pac$aur")
|
||||
}
|
||||
|
||||
xbps_check(){
|
||||
@ -26,9 +23,9 @@ xbps_check(){
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
text="<span foreground='#929292'></span> $pkg_count"
|
||||
tooltip=$(awk '$0=$1' ORS='\\n' <<< "$pkg")
|
||||
printf '{"text": "%s", "tooltip": "%s"}' "$text" "$tooltip"
|
||||
tooltip=$(awk -v ORS='\\n' '$0=$1' <<< "$pkg")
|
||||
}
|
||||
|
||||
if grep -i "arch" /etc/os-release &>/dev/null
|
||||
@ -38,3 +35,6 @@ elif grep -i "void" /etc/os-release &>/dev/null
|
||||
then
|
||||
xbps_check
|
||||
fi
|
||||
|
||||
# Print json
|
||||
printf '{"text": "%s", "tooltip": "%s"}' "$text" "$tooltip"
|
||||
|
Loading…
Reference in New Issue
Block a user