aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-08-07 18:41:26 +0300
committereug-vs <eugene@eug-vs.xyz>2022-08-07 18:41:26 +0300
commit344d53103da67aebcb956dce6114bcf7c4488059 (patch)
tree322fcf7cfdfa5f8508037be3241a5af9df2072a7
parent3789dd4a4c7e9d7851538bb05d2797a70e6cea07 (diff)
downloaddotfiles-344d53103da67aebcb956dce6114bcf7c4488059.tar.gz
feat(zsh): use red color for root prompt
-rw-r--r--zsh/.zshrc9
1 files changed, 8 insertions, 1 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 9105e9b..69afe27 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -1,7 +1,14 @@
autoload -U colors && colors
-PS1="%B%{$fg[white]%}[%{$fg[cyan]%}%n%{$fg[white]%}@%{$fg[green]%}%M %{$fg[yellow]%}%~%{$fg[white]%}]%{$reset_color%}$%b "
bindkey -e
+# Shell prompt
+if [ $(id -u) -eq 0 ];
+then # you are root, set red colour prompt
+ PS1="%B%{$fg[white]%}[%{$fg[red]%}%n%{$fg[white]%}@%{$fg[green]%}%M %{$fg[yellow]%}%~%{$fg[white]%}]%{$reset_color%}$%b "
+else
+ PS1="%B%{$fg[white]%}[%{$fg[cyan]%}%n%{$fg[white]%}@%{$fg[green]%}%M %{$fg[yellow]%}%~%{$fg[white]%}]%{$reset_color%}$%b "
+fi
+
# History in cache directory:
export HISTSIZE=10000
export SAVEHIST=10000000