Custom Bash Prompt

Prompt

function set_ps1 {
    export PS1="\n\033[4m\u@\h:\w $(git branch 2>/dev/null | grep '*')\033[0m\n$ "
}
export PROMPT_COMMAND=set_ps1

Meanings of tokens of the prompt above:

  • \n — New line
  • \033[4m — Start of underline
  • \033[0m — End of underline
  • \u — Username
  • \h — Host name
  • \w — Working directory (full path)

You'll only receive email when they publish something new.

More from 19411
All posts