From 5b0e551b5a3584618e06bfde769878b4b6944835 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Sat, 1 Aug 2015 19:09:31 +0200 Subject: [PATCH] more idiomatic check for systemctl --- zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.5