| 11 | | I like to change the color, and structure, of my Bash prompt to make a more clear distinction between the area that I am typing and the prompt. A typical Bash prompt looks like {{{user@machine:present working directory$ }}} (see: [/attachment/wiki/Wisdom/Bash/bash_prompt_default.png image]). A stylized prompt could look like [/attachment/wiki/Wisdom/Bash/bash_prompt_color.png this]. |
| | 11 | I like to change the color, and structure, of my Bash prompt to make a more clear distinction between the area that I am typing and the prompt. A typical Bash prompt looks like {{{user@machine:present working directory$ }}} (see: [/attachment/wiki/Wisdom/Bash/bash_prompt_default.png image]). A stylized prompt could look like [/attachment/wiki/Wisdom/Bash/bash_prompt_color.png this]. You can change the structure (where to put the machine name, user name, path) and the color of each element. My {{{.prompt}}} file defines all of the colors, and shows and example structure: |
| | 12 | {{{ |
| | 13 | COL_BLACK=$'\[\033[30m\]' |
| | 14 | COL_RED=$'\[\033[31m\]' |
| | 15 | COL_GREEN=$'\[\033[32m\]' |
| | 16 | COL_YELLOW_ORANGE=$'\[\033[33m\]' |
| | 17 | COL_BLUE=$'\[\033[34m\]' |
| | 18 | COL_MAGENTA=$'\[\033[35m\]' |
| | 19 | COL_CYAN=$'\[\033[36m\]' |
| | 20 | COL_NORM=$'\[\033[39m\]' |
| | 21 | PMPT_BOLD=$'\[\033[1m\]' |
| | 22 | PMPT_NORM=$'\[\033[0m\]' |
| | 23 | |
| | 24 | # See: http://networking.ringofsaturn.com/Unix/Bash-prompts.php |
| | 25 | # for a longer list of colours. |
| | 26 | |
| | 27 | PS1="${PMPT_BOLD}${COL_CYAN}\h${COL_YELLOW_ORANGE} [\w] %${PMPT_NORM} " |
| | 28 | }}} |