From 230a0a60bf16534c046dfa83aac3f13e7eb45fc8 Mon Sep 17 00:00:00 2001 From: "Daniel A. Maierhofer" Date: Tue, 27 Mar 2018 17:58:00 +0200 Subject: [PATCH] Add colorful prompt --- templates/bashrc.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/bashrc.j2 b/templates/bashrc.j2 index 0e0fb15..38f1851 100644 --- a/templates/bashrc.j2 +++ b/templates/bashrc.j2 @@ -63,7 +63,9 @@ if [ -n "$force_color_prompt" ]; then fi if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \$ ' + color_prompt_cols=('1;35' '0;32' '0;33' '0;34' '0;35' '0;36' '0;37' '1;31' '1;32' '1;33' '1;34' '0;31' '1;36' '1;37') + color_prompt_col='\[\e[${color_prompt_cols[$(echo "${HOSTNAME}" | md5sum | sed s/[abcdef]*// | head -c 1)]}m\]' + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@'$color_prompt_col'\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h \w \$ ' fi