From b28e6e562084ddb224b3ea4740b8926427d7dda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Sun, 21 May 2017 14:49:24 +0200 Subject: [PATCH] PS1: add user+hostname-based color in PS1 --- files/.bash_ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/.bash_ps1 b/files/.bash_ps1 index 1d8d66a..bb6de04 100644 --- a/files/.bash_ps1 +++ b/files/.bash_ps1 @@ -7,6 +7,10 @@ _tred="\[$(tput setaf 1)\]" _tblue="\[$(tput setaf 4)\]" _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}