MVP (Minimum Viable Prompt)

It is so easy to make mistakes, just because you're not in the right machine, right folder ... or even worse, when you're root ... This is a minimal .bashrc to avoid these kind of situations ...

Nota Bene :

  • the C_HOST variable may be adapted for each host
  • the number between brackets is intended make redos easier and less prone to errors

Example 1, as standard user :

standard

Example 2, as root (on an other host) :

root

export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'

# custom prompt
C_ESC="\[\e[m\]"
C_TAG="(\!)"
C_USER=$COLOR_ESC
C_HOST="\[\e[1;32m\]"
C_PATH="\[\e[1;37m\]"

if [ $USER == "root" ]; then
  C_USER="\[\e[1;31m\]";
  C_TAG="$C_USER\342\226\210\342\226\210$C_ESC (\!)"
fi

export PS1="$C_TAG $C_USER\u$C_ESC@$C_HOST\h$CESC:$C_PATH\w$C_USER\\$ $C_ESC"

links

social