From: Christoph Egger Date: Sat, 1 Aug 2015 17:09:31 +0000 (+0200) Subject: more idiomatic check for systemctl X-Git-Url: https://git.siccegge.de//index.cgi?p=dotfiles%2Fzsh.git;a=commitdiff_plain;h=5b0e551b5a3584618e06bfde769878b4b6944835 more idiomatic check for systemctl --- diff --git a/zshrc b/zshrc index 64ad4ea..1f54e35 100644 --- a/zshrc +++ b/zshrc @@ -65,7 +65,7 @@ precmd () { vcs_info setWindowTitle ${USER}@${HOST} - if [[ $UID == 0 && -f `which systemctl` ]] + if [[ $UID == 0 && $+commands[systemctl] != 0 ]] then use_systemd=true systemd_failed="`systemctl --state=failed | grep failed | cut -d \ -f 2 | tr '\n' ' '`" @@ -93,7 +93,7 @@ case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in ;; esac -if [[ $UID == 0 && -f `which systemctl` ]] +if [[ $UID == 0 && $+commands[systemctl] != 0 ]] then PROMPT=$'%{$fg[red]>> $systemd_failed$reset_color%}\n' else