From: Samir Benmendil Date: Mon, 9 Aug 2021 13:06:09 +0000 (+0100) Subject: zsh: only print pacman updates if checkupdates exists X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/386180eb3bade84be3e31e25bffa689999ef9e7d?ds=inline zsh: only print pacman updates if checkupdates exists --- diff --git a/zsh/lib/motd.zsh b/zsh/lib/motd.zsh index 59dcad3..c496767 100644 --- a/zsh/lib/motd.zsh +++ b/zsh/lib/motd.zsh @@ -15,10 +15,12 @@ if [[ -d ~/org ]]; then todo | cut -c-$((COLUMNS + 44)) fi -# checkupdate.service populates this db -pkg_count=$(checkupdates -n | grep -cv '\[.*\]') -if (( $pkg_count > 0 )); then - short "Outdated packages: $pkg_count" +if (( $+commands[checkupdates] )); then + # checkupdate.service populates this db + pkg_count=$(checkupdates -n | grep -cv '\[.*\]') + if (( $pkg_count > 0 )); then + short "Outdated packages: $pkg_count" + fi fi # list sessions if possible