From 7208fd240953edf5f7a19495c91fa393b567aa2b Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 19 Jul 2021 18:02:26 +0200 Subject: [PATCH] Display hostname in magenta if current host cannot be determined --- functions/fish_prompt.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index dcbd46e..271a95d 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -36,7 +36,10 @@ function fish_prompt # Hostname - if test (who am i | awk '{print $5}') = "(:0)" + set -g CURRENT_IP (who am i | awk '{print $5}') + if test -z "$CURRENT_IP" + set_color magenta + else if test "$CURRENT_IP" "=" "(:0)" set_color green else set_color cyan