Skip to content

Instantly share code, notes, and snippets.

@alex-salnikov
Created October 10, 2022 08:00
Show Gist options
  • Save alex-salnikov/68d7cd1d70125cf405067974714e22d6 to your computer and use it in GitHub Desktop.
Save alex-salnikov/68d7cd1d70125cf405067974714e22d6 to your computer and use it in GitHub Desktop.
custom prompt
# ~/.bashrc
# prompt - Alex, 19.09.2022
# https://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/
# \! - history id
# \$? - RC of last command
# \u - user
# \h - hostname
# \w - workdir
# \n - new line
COLOR_BLACK="\e[0;30m"
COLOR_BLUE="\e[0;34m"
COLOR_GREEN="\e[0;32m"
COLOR_CYAN="\e[0;36m"
COLOR_RED="\e[0;31m"
COLOR_PURPLE="\e[0;35m"
COLOR_BROWN="\e[0;33m"
COLOR_END="\e[m"
export PS1="\n\!: (\$?) $COLOR_GREEN\u@\h$COLOR_END $COLOR_BLUE\w$COLOR_END \n> "
# https://unix.stackexchange.com/questions/31695/how-to-make-the-terminal-display-usermachine-in-bold-letters
#color () {
# if [ -z "$1" -a -z "$2" -a -z "$3" ]; then
# echo "\033[0m"
# return
# fi
# case $1 in
# black) color_fg=30;;
# red) color_fg=31;;
# green) color_fg=32;;
# yellow) color_fg=33;;
# blue) color_fg=34;;
# magenta|purple) color_fg=35;;
# cyan) color_fg=36;;
# white) color_fg=37;;
# -) color_fg='';;
# *) color_fg=39;;
# esac
# case $2 in
# bold) color_bd=1;;
# italics) color_bd=3;;
# underline) color_bd=4;;
# inverse) color_bd=7;;
# strike) color_bd=9;;
# nobold) color_bd=22;;
# noitalics) color_bd=23;;
# nounderline) color_bd=24;;
# noinverse) color_bd=27;;
# nostrike) color_bd=29;;
# -) color_bd='';;
# *) color_bd=0
# esac
# case $3 in
# black) color_bg=40;;
# red) color_bg=41;;
# green) color_bg=42;;
# yellow) color_bg=43;;
# blue) color_bg=44;;
# magenta|purple) color_bg=45;;
# cyan) color_bg=46;;
# white) color_bg=47;;
# -) color_bg='';;
# *) color_bg=49;;
# esac
# s='\033['
# if [ -n "$color_bd" ]; then
# s="${s}${color_bd}"
# if [ -n "$color_fg" -o -n "$color_bg" ]; then
# s="${s};"
# fi
# fi
# if [ -n "$color_fg" ]; then
# s="${s}${color_fg}"
# if [ -n "$color_bg" ]; then
# s="${s};"
# fi
# fi
# if [ -n "$color_bg" ]; then
# s="${s}${color_bg}"
# fi
# s="${s}m"
# echo "$s"
# unset s color_bd color_bg color_fg
#}
#color_reset=`color`
#color_grbd=`color green bold`
#export PS1="\!: (\$?) ${color green}\u${color}@${color blue}\h${color} \w \n> "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment