Bash Color

Intro Bash์—์„œ Color๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณธ๋‹ค. bash๋กœ ์ž‘์„ฑํ•œ ํ”„๋กœ๊ทธ๋žจ์˜ ์ถœ๋ ฅ์ด๋‚˜ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์˜ˆ์˜๊ฒŒ ํ‘œํ˜„ํ•ด ๋ณด์ž. ๊ทธ๋Ÿฌ๋‚˜ ์ง€๋‚˜์นœ ์‹œ๊ฐ„ ํˆฌ์ž ๋ณด๋‹ค๋Š” ์ƒ‰๊น”์ด ์ฃผ๋Š” ์ฃผ๋ชฉ์„ฑ๊ณผ ๊ตฌ๋ถ„๋ ฅ, ํŽธํ•œํ•จ, ๊ฐ„๊ฒฐํ•จ์— ์ง‘์ค‘ํ•˜์ž. Map the colors # Color mapping grey='\[\033[1;30m\]' red='\[\033[0;31m\]' RED='\[\033[1;31m\]' green='\[\033[0;32m\]' GREEN='\[\033[1;32m\]' yellow='\[\033[0;33m\]' YELLOW='\[\033[1;33m\]' purple='\[\033[0;35m\]' PURPLE='\[\033[1;35m\]' white='\[\033[0;37m\]' WHITE='\[\033[1;37m\]' blue='\[\033[0;34m\]' BLUE='\[\033[1;34m\]' cyan='\[\033[0;36m\]' CYAN='\[\033[1;36m\]' NC='\[\033[0m\]' Bash Prompt ~/.bash_profile์ด๋‚˜ ~/.bashrc์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž‘์„ฑํ•˜๊ณ  ๋‹ค์‹œ ๋กœ๊ทธ์ธ case $HOSTNAME in plato*) PSC="\e[1;33m" ;; *) PSC="\e[36m" ;; esac PS1="[\j]\[${PSC}\]\u@\h(\l) \[\e[37m\][ \w ]\[\e[00m\]\n\[\e[1m\]\#\[\e[0m\] \$ " REFERENCE Bash Prompt Generator : https://robotmoon.com/bash-prompt-generator/ Customizing Bash Prompt : https://linuxopsys.com/topics/customizing-bash-prompt-in-linux-changing-colors

2023-08-10 ยท 84 words