22 lines
558 B
Bash
Executable File
22 lines
558 B
Bash
Executable File
#!/bin/sh
|
|
|
|
big="\033[11m"
|
|
reset="\033[0m"
|
|
icon=""
|
|
|
|
if command -v pacman 1>/dev/null 2>&1; then
|
|
num="$(pacman -Qu | grep -Fcv "[ignored]")"
|
|
[ "$num" -gt 0 ] && printf "%b" "$big$icon$reset$num"
|
|
fi
|
|
|
|
if command -v apt 1>/dev/null 2>&1; then
|
|
vals=$(apt upgrade -sy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9 ' | tr ' ' '\n' | grep '[0-9]\+' | xargs)
|
|
|
|
for i in $vals; do
|
|
[ "$i" != 0 ] && updates_available=yes
|
|
out="$out$i/"
|
|
done
|
|
|
|
[ -n "$updates_available" ] && printf "%b" "$big$icon$reset $(echo "$out" | sed 's/\/$//')" || exit 0
|
|
fi
|