Last active
February 27, 2019 16:38
-
-
Save namgivu/f85342cdfba60c2fcd3937d96e73387a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash -i | |
#ref. https://blog.bigdinosaur.org/easy-ps1-colors/ | |
#ref. https://stackoverflow.com/a/5716557/248616 | |
#ref. https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ | |
echo " | |
# color code color code bold | |
# ---------------- ---------------- | |
ps1_BLACK='\[\033[0;30m\]' b_ps1_BLACK='\[\033[1;30m\]' | |
ps1_RED='\[\033[0;31m\]' b_ps1_RED='\[\033[1;31m\]' | |
ps1_GREEN='\[\033[0;32m\]' b_ps1_GREEN='\[\033[1;32m\]' | |
ps1_YELLOW='\[\033[0;33m\]' b_ps1_YELLOW='\[\033[1;33m\]' | |
ps1_BLUE='\[\033[0;34m\]' b_ps1_BLUE='\[\033[1;34m\]' | |
ps1_PURPLE='\[\033[0;35m\]' b_ps1_PURPLE='\[\033[1;35m\]' | |
ps1_CYAN='\[\033[0;36m\]' b_ps1_CYAN='\[\033[1;36m\]' | |
ps1_WHITE='\[\033[0;37m\]' b_ps1_WHITE='\[\033[1;37m\]' | |
" | |
PS1_COLOR_END='\[\033[00m\]' | |
_PS1="$PS1" # save current PS1 | |
bold=0 | |
for color in {30..37}; do | |
ps1_color="\[\033[$bold;${color}m\]" | |
new_PS1="export PS1='$ps1_color\u@\h$PS1_COLOR_END <-- this color is defined by above command \\$ ' " | |
echo $new_PS1 | |
done | |
echo; echo "export PS1='$_PS1'"; echo | |
echo 'echo ------------------------------------------------------------------------------------------'; echo | |
bold=1 | |
for color in {30..37}; do | |
ps1_color="\[\033[$bold;${color}m\]" | |
new_PS1="export PS1='$ps1_color\u@\h$PS1_COLOR_END <-- this color is defined by above command \\$ ' " | |
echo $new_PS1 | |
done | |
echo; echo "export PS1='$_PS1'"; echo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment