Good article CT. Here is what I do in my .bashrc:
Then I can access these color just using their assigned vars. Here is my login welcome text.Code:# Define some colors first: red='\e[0;31m' RED='\e[1;31m' green='\e[0;32m' GREEN='\e[1;32m' blue='\e[0;34m' BLUE='\e[1;34m' cyan='\e[0;36m' CYAN='\e[1;36m' NC='\e[0m' # No Color
And since I like colors in my prompt, and I like a color indicator if I am root. Here is how I do that.Code:echo -e "${CYAN}Welcome to ${HOSTNAME} ${USERNAME}.${cyan}" echo -e "${cyan}Today is::${RED}$TODAY_IS" echo -e "${cyan}Uptime::::${RED}$MY_UPTIME${NC}"
Keeps the console interesting for me. I don't have to completely read everything either, the color coding tells me what I need to know faster than I can read it.Code:# Check if I'm root, make the username red of so UC=$NC #default user color if [ $UID -eq 0 ]; then UC=$RED fi export PS1="\n${UC}\u${NC}@\h:[${CYAN}\w${NC}]\n[\@]:"


Reply With Quote
)
Bookmarks