cfg/.config/i3blocks/arch-update
Knut Ahlers a0d09f6aca
Fix: Remove newline, caused 1-off error
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-12-05 22:46:22 +01:00

24 lines
467 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
req_restart_prefix=(
linux
systemd
)
function get_grep() {
local IFS_bak="${IFS}"
IFS="|"
echo "${req_restart_prefix[*]}"
IFS="${IFS_bak}"
}
updates=$(checkupdates)
num=$(echo -n "${updates}" | wc -l)
[ $num -gt 0 ] || exit
req_restart=""
echo "${updates}" | grep -qE "^($(get_grep)) " && req_restart=' <span color="#dd0000">(reboot)</span>'
printf "\uf94f %d %s%s" $num $(${HOME}/bin/pluralize Update $num) "${req_restart}"