fancy_prompt_cookbook
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | fancy_prompt_cookbook [2010/06/17 14:39] (current) – created tkbletsc | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Fancy prompt cookbook ====== | ||
+ | |||
+ | It is nice to make your bash prompt look good. Here is a base script that defines all the ANSI colors as variables and sets up a clear PS1 prompt variable. | ||
+ | |||
+ | <code bash> | ||
+ | RESET=" | ||
+ | BOLD=" | ||
+ | FAINT=" | ||
+ | UNDERLINE=" | ||
+ | REVERSE=" | ||
+ | STRIKEOUT=" | ||
+ | LO_BLACK=" | ||
+ | LO_RED=" | ||
+ | LO_GREEN=" | ||
+ | LO_YELLOW=" | ||
+ | LO_BLUE=" | ||
+ | LO_MAGENTA=" | ||
+ | LO_CYAN=" | ||
+ | LO_WHITE=" | ||
+ | HI_BLACK=" | ||
+ | HI_RED=" | ||
+ | HI_GREEN=" | ||
+ | HI_YELLOW=" | ||
+ | HI_BLUE=" | ||
+ | HI_MAGENTA=" | ||
+ | HI_CYAN=" | ||
+ | HI_WHITE=" | ||
+ | BG_BLACK=" | ||
+ | BG_RED=" | ||
+ | BG_GREEN=" | ||
+ | BG_YELLOW=" | ||
+ | BG_BLUE=" | ||
+ | BG_MAGENTA=" | ||
+ | BG_CYAN=" | ||
+ | BG_WHITE=" | ||
+ | |||
+ | |||
+ | # ======================= BASH PROMPT ESCAPE CODES ========================== | ||
+ | # == Time & Date == | ||
+ | # \t Time in 24-hour HH:MM:SS format | ||
+ | # \A Time in 24-hour HH:MM format | ||
+ | # \d Date, e.g. "Tue May 26" | ||
+ | # | ||
+ | # == Characters == | ||
+ | # \a ASCII bell \e ASCII escape character | ||
+ | # \n Newline | ||
+ | # \[ Start of non-printing characters | ||
+ | # \\ A backslash | ||
+ | # | ||
+ | # == Shell Info == | ||
+ | # \v Short version (e.g. " | ||
+ | # \! History number of this command | ||
+ | # \j Number of jobs \l Basename of the shell' | ||
+ | # \s Shell name (e.g. " | ||
+ | # | ||
+ | # == Current Environment == | ||
+ | # \h Short hostname | ||
+ | # \w Current working directory | ||
+ | # \u Current username | ||
+ | # \$ Shell prompt (either ' | ||
+ | # | ||
+ | |||
+ | if [ `whoami` = " | ||
+ | then | ||
+ | export PS1=" | ||
+ | else | ||
+ | #export PS1=" | ||
+ | #export PS1=" | ||
+ | export PS1=" | ||
+ | fi | ||
+ | |||
+ | unset R RESET BOLD FAINT UNDERLINE REVERSE STRIKEOUT LO_BLACK LO_RED LO_GREEN LO_YELLOW LO_BLUE LO_MAGENTA LO_CYAN LO_WHITE | ||
+ | unset HI_BLACK HI_RED HI_GREEN HI_YELLOW HI_BLUE HI_MAGENTA HI_CYAN HI_WHITE BG_BLACK BG_RED BG_GREEN BG_YELLOW BG_BLUE BG_MAGENTA BG_CYAN BG_WHITE | ||
+ | |||
+ | </ | ||
+ | |||
+ | Also, if your environment isn't updating the tab titles in your graphical terminal, you can append the following line to fix that: | ||
+ | <code bash> | ||
+ | export PS1=" | ||
+ | </ | ||
fancy_prompt_cookbook.txt · Last modified: 2010/06/17 14:39 by tkbletsc