PS1: add user+hostname-based color in PS1
This commit is contained in:
parent
07f6336ff7
commit
b28e6e5620
1 changed files with 5 additions and 1 deletions
|
@ -7,6 +7,10 @@ _tred="\[$(tput setaf 1)\]"
|
||||||
_tblue="\[$(tput setaf 4)\]"
|
_tblue="\[$(tput setaf 4)\]"
|
||||||
_tmag="\[$(tput setaf 5)\]"
|
_tmag="\[$(tput setaf 5)\]"
|
||||||
|
|
||||||
export PS1="${_tbold}[${_tred}\u@\h ${_tblue}\W${_treset}${_tbold}]\\$ ${_treset}"
|
host_color_code=$(echo "$(whoami)|$(hostname)" | md5sum | cut -f1 -d' ' \
|
||||||
|
| tr -d '\n' | tail -c2)
|
||||||
|
host_color="\[$(tput setaf 0x${host_color_code})\]"
|
||||||
|
|
||||||
|
export PS1="${_tbold}[${host_color}◉${_tred}\u@\h ${_tblue}\W${_treset}${_tbold}]\\$ ${_treset}"
|
||||||
|
|
||||||
unset _t{bold,reset,red,blue,mag}
|
unset _t{bold,reset,red,blue,mag}
|
||||||
|
|
Loading…
Reference in a new issue