zsh: randomize prompt color according to hostname
parent
f245213512
commit
bd1d3b9156
13
zsh/.zshrc
13
zsh/.zshrc
|
@ -95,15 +95,12 @@ zle -N zle-keymap-select
|
||||||
|
|
||||||
if [ $(whoami) = "root" ]
|
if [ $(whoami) = "root" ]
|
||||||
then
|
then
|
||||||
if [ $USER = "root" ]
|
COLOR="red"
|
||||||
then COLOR="red"
|
|
||||||
else COLOR="blue"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [ -n "$SSH_CLIENT" ]
|
colors=(blue green cyan magenta yellow)
|
||||||
then COLOR="blue"
|
color_index=$(($(hostname | sum | cut -f1 -d" ") % $#colors + 1))
|
||||||
else COLOR="green"
|
|
||||||
fi
|
COLOR=$colors[$color_index]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PS1='%m%{$fg[$COLOR]%}:%{$reset_color%}%~${vcs_info_msg_0_}%{$fg[$COLOR]%}%#%{$reset_color%} '
|
export PS1='%m%{$fg[$COLOR]%}:%{$reset_color%}%~${vcs_info_msg_0_}%{$fg[$COLOR]%}%#%{$reset_color%} '
|
||||||
|
|
Loading…
Reference in New Issue