more idiomatic check for systemctl
authorChristoph Egger <christoph@christoph-egger.org>
Sat, 1 Aug 2015 17:09:31 +0000 (19:09 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Sat, 1 Aug 2015 17:09:31 +0000 (19:09 +0200)
zshrc

diff --git a/zshrc b/zshrc
index 64ad4eaceb21954fb67ff78829269572a6b7812f..1f54e35a8d3c8321eef7361c5f88e4cc962e9f0d 100644 (file)
--- 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