From d486c08b2dd4badb323f28d2e5ca464d9da4080f Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Sat, 1 Aug 2015 18:48:46 +0200 Subject: [PATCH] Add failed systemctl services to root's prompt --- zshrc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index a6df101..abd47ce 100644 --- a/zshrc +++ b/zshrc @@ -55,6 +55,12 @@ setWindowTitle(){ precmd () { vcs_info setWindowTitle ${USER}@${HOST} + + if [[ $UID == 0 && -f `which systemctl` ]] + then + use_systemd=true + systemd_failed="`systemctl --state=failed | grep failed | cut -d \ -f 2 | tr '\n' ' '`" + fi } config=("default" "`uname -s`") @@ -78,7 +84,15 @@ case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in ;; esac -PROMPT=$'%{$fg[yellow]%}%n@%{$fg[magenta]%}%m%{$reset_color%} %~ \n%{$fg[cyan]%}%T%{$reset_color%} %0(?,%{$fg[green]%},%{$fg[red]%}%s)%?%{$reset_color%} %# ' +if [[ $UID == 0 && -f `which systemctl` ]] +then + PROMPT=$'%{$fg[red]>> $systemd_failed$reset_color%}\n' +else + PROMPT="" +fi + +PROMPT+=$'%{$fg[yellow]%}%n@%{$fg[magenta]%}%m%{$reset_color%} %~ \n%{$fg[cyan]%}%T%{$reset_color%} %0(?,%{$fg[green]%},%{$fg[red]%}%s)%?%{$reset_color%} %# ' + RPROMPT='${vcs_info_msg_0_}' export DEBEMAIL='christoph@debian.org' -- 2.39.2