From f6e93d23546ccada053e274d40452fef141f17b4 Mon Sep 17 00:00:00 2001 From: Jacob Garby Date: Thu, 18 Apr 2024 08:44:34 +0200 Subject: [PATCH] updated how prompt alert works --- install.sh | 2 ++ prompt-alert.sh | 15 ++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 8448fbd..fc57364 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,7 @@ #!/usr/bin/bash +# This could be done with a link, but since the resman code resides in my own home directory, +# most people would not have permission to execute that file. cp ./resman.py /usr/bin/resman echo "Installed successfully at /usr/bin/resman. Make sure /usr/bin is in \$PATH" diff --git a/prompt-alert.sh b/prompt-alert.sh index b9b20a8..3101552 100644 --- a/prompt-alert.sh +++ b/prompt-alert.sh @@ -1,13 +1,2 @@ -# Set RESMAN_ALERT to a red `!` when the system is reserved -update_resman_alert() { - if resman; then - RESMAN_ALERT="" - else - RESMAN_ALERT=$'\e[31m!\e[0m' - fi -} - -PS1='${RESMAN_ALERT}'$PS1 - -# Recompute RESMAN_ALERT every time the prompt is refreshed -PROMPT_COMMAND="update_resman_alert;${PROMPT_COMMAND:+$PROMPT_COMMAND}" +_RESMAN_WORD="server in use..." +PS1='$(if resman; then echo; else printf "\[\033[0;31m\](${_RESMAN_WORD})\[\033[0m\] "; fi)'"${PS1}"