_NODE_NAME="${HOSTNAME%%.*}" _NODE_NAME="${_NODE_NAME%%[0-9]*}" # strip numbers at the end # # ANSI Color table - \[033[I;3Xm\] # # (I)ntensity 0 1 2 3 4 5 6 7 8 9 # Normal (0) Black Red Green Brown Blue Purple Teal Grey !Custom !TermDefault # Bright (1) DkGrey Red Green Yellow Blue Magenta Cyan White !Custom !TermDefault # case $( /usr/bin/systemd-detect-virt ) in kvm|qemu) # virtual machine _NODE_TYPE_STR="\[\033[0;36m\]SERVICES" # teal _NODE_NAME_CLR="\[\033[1;33m\]" # brown/golden ;; lxc|lxc-libvirt|systemd-nspawn) # container _NODE_TYPE_STR="\[\033[0;36m\]SERVICES" # teal _NODE_NAME_CLR="\[\033[1;37m\]" # white ;; none|*) # physical machine - default _NODE_TYPE_STR="\[\033[0;36m\]CLUSTER" # teal _NODE_NAME_CLR="\[\033[0;35m\]" # purple ;; esac case ${_NODE_NAME} in s) # regular worker node _NODE_TYPE_STR="\[\033[1;37m\]WN" # white WN sign _NODE_NAME_CLR="\[\033[1;30m\]" # dark grey ;; g) # grid worker node _NODE_TYPE_STR="\[\033[0;32m\]G-\[\033[1;37m\]WN" # green "G" and white WN sign _NODE_NAME_CLR="\[\033[1;30m\]" # dark grey ;; ## Physical machines ## a) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden hedgehog) _NODE_NAME_CLR="\[\033[0;35m\]" ;; # purple ovirt) _NODE_NAME_CLR="\[\033[0;32m\]" ;; # green storage) _NODE_NAME_CLR="\[\033[1;36m\]" ;; # cyan shadow) _NODE_NAME_CLR="\[\033[1;30m\]" ;; # dark grey ## Containers ## a-fhgfs) _NODE_NAME_CLR="\[\033[1;37m\]" ;; # white radix) _NODE_NAME_CLR="\[\033[0;35m\]" ;; # purple knot) _NODE_NAME_CLR="\[\033[0;36m\]" ;; # teal ## Virtual machines ## alien) _NODE_NAME_CLR="\[\033[1;34m\]" ;; # bright blue aux) _NODE_NAME_CLR="\[\033[1;30m\]" ;; # dark grey bs) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden cacti) _NODE_NAME_CLR="\[\033[1;34m\]" ;; # bright blue db) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden enterprise) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # orange/brown gap) _NODE_NAME_CLR="\[\033[0;32m\]" ;; # green glite) _NODE_NAME_CLR="\[\033[1;34m\]" ;; # bright blue lfc) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden gris) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden mx) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # orange/brown se) _NODE_NAME_CLR="\[\033[1;36m\]" ;; # cyan squid) _NODE_NAME_CLR="\[\033[1;36m\]" ;; # cyan topbdii) _NODE_NAME_CLR="\[\033[0;31m\]" ;; # dark red voms) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden web) _NODE_NAME_CLR="\[\033[1;33m\]" ;; # golden esac if [ $UID -eq 0 ]; then # root? _NODE_INIT_CLR="\[\033[1;31m\]" # bright red _NODE_USER_CLR="\[\033[1;31m\]" # bright red else _NODE_INIT_CLR="\[\033[1;32m\]" # bright green _NODE_USER_CLR="\[\033[1;32m\]" # bright green fi PS1="${_NODE_INIT_CLR}KNU\[\033[0;31m\]:${_NODE_TYPE_STR}\[\033[0;31m\]:${_NODE_NAME_CLR}\h ${_NODE_USER_CLR}[\u \W]\\$\[\033[0;39m\] " unset _NODE_NAME unset _NODE_TYPE_STR unset _NODE_NAME_CLR unset _NODE_INIT_CLR unset _NODE_USER_CLR # Disable duplicates in history export HISTCONTROL="ignoreboth:erasedups" export HISTIGNORE="history:[bf]g:exit" # append to the history file, don't overwrite it shopt -s histappend # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize