Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 쇼펜의상속자 #킨텍스메가쇼 #섬유향수탈취제
- PERL
- cadre
- Hack
- rm
- windows
- 칭찬교육
- goaccess
- PORT
- Kernel
- 리눅스
- Performance
- ext3
- apachetop
- Disk
- Cache
- rm -rf
- http
- pid
- Bash
- rsync
- Linux
- iptables
- 솔라리스
- CPU
- 좌절교육
- DNS
- Python
- 디스크
- ext4
Archives
- Today
- Total
Ben's
쉘 스크립트에서 글자 색 적용 본문
728x90
쉘 스크립트에서 글자 색 적용Linux-Kernel
2012/01/07 01:12
http://blog.naver.com/ssregimin/147674771
전용뷰어 보기
참고글: http://www.bashguru.com/2010/01/shell-colors-colorizing-shell-scripts.html
echo -e "\033[COLOR1;COLOR2m sample text\033[0m"
[ TEXT ATTRIBUTES ]
ANSI CODE Meaning
0 Normal Characters
1 Bold Characters
4 Underlined Characters
5 Blinking Characters
7 Reverse video Characters
[ COLORS ]
Bold off color Bold on color
0;30 Balck 1;30 Dark Gray
0;31 Red 1;31 Dark Red
0;32 Green 1;32 Dark Green
0;33 Brown 1;33 Yellow
0;34 Blue 1;34 Dark Blue
0;35 Magenta 1;35 Dark Magenta
0;36 Cyan 1;30 Dark Cyan
0;37 Light Gray 1;30 White
[ Some examples: ]
Block background and white text
echo -e "\033[40;37m Hello World\033[0m"
Reverse video text attribute option interchanges fg and bg colors.
Bellow statement prints block on white
echo -e "\033[40;37;7m Hello World\033[0m"
echo -e "\033[33;44m Yellow text on blue background\033[0m"
echo -e "\033[1;33;44m Bold yellow text on blue background\033[0m"
echo -e "\033[1;4;33;44mBold yellow underlined text on blue background\033[0m"
[ The "tput" command: ]
Other than echo there is a command called tput using which we
can control the way the output is displayed on the screen.But it is
less flexible than ANSI escape sequences.
[ SCRIPT SAMPLE ]
#!/bin/bash
# This script echoes colors and codes
echo -e "\n\033[4;31mLight Colors\033[0m \t\t\033[1;4;31mDark Colors\033[0m"
echo -e "\e[0;30;47m Black \e[0m 0;30m \t\e[1;30;40m Dark Gray \e[0m 1;30m"
echo -e "\e[0;31;47m Red \e[0m 0;31m \t\e[1;31;40m Dark Red \e[0m 1;31m"
echo -e "\e[0;32;47m Green \e[0m 0;32m \t\e[1;32;40m Dark Green \e[0m 1;32m"
echo -e "\e[0;33;47m Brown \e[0m 0;33m \t\e[1;33;40m Yellow \e[0m 1;33m"
echo -e "\e[0;34;47m Blue \e[0m 0;34m \t\e[1;34;40m Dark Blue \e[0m 1;34m"
echo -e "\e[0;35;47m Magenta \e[0m 0;35m \t\e[1;35;40m DarkMagenta\e[0m 1;35m"
echo -e "\e[0;36;47m Cyan \e[0m 0;36m \t\e[1;36;40m Dark Cyan \e[0m 1;36m"
echo -e "\e[0;37;47m LightGray\e[0m 0;37m \t\e[1;37;40m White \e[0m 1;37m"
http://cafe.naver.com/ghson/397
2012/01/07 01:12
http://blog.naver.com/ssregimin/147674771
전용뷰어 보기
참고글: http://www.bashguru.com/2010/01/shell-colors-colorizing-shell-scripts.html
echo -e "\033[COLOR1;COLOR2m sample text\033[0m"
[ TEXT ATTRIBUTES ]
ANSI CODE Meaning
0 Normal Characters
1 Bold Characters
4 Underlined Characters
5 Blinking Characters
7 Reverse video Characters
[ COLORS ]
Bold off color Bold on color
0;30 Balck 1;30 Dark Gray
0;31 Red 1;31 Dark Red
0;32 Green 1;32 Dark Green
0;33 Brown 1;33 Yellow
0;34 Blue 1;34 Dark Blue
0;35 Magenta 1;35 Dark Magenta
0;36 Cyan 1;30 Dark Cyan
0;37 Light Gray 1;30 White
[ Some examples: ]
Block background and white text
echo -e "\033[40;37m Hello World\033[0m"
Reverse video text attribute option interchanges fg and bg colors.
Bellow statement prints block on white
echo -e "\033[40;37;7m Hello World\033[0m"
echo -e "\033[33;44m Yellow text on blue background\033[0m"
echo -e "\033[1;33;44m Bold yellow text on blue background\033[0m"
echo -e "\033[1;4;33;44mBold yellow underlined text on blue background\033[0m"
[ The "tput" command: ]
Other than echo there is a command called tput using which we
can control the way the output is displayed on the screen.But it is
less flexible than ANSI escape sequences.
[ SCRIPT SAMPLE ]
#!/bin/bash
# This script echoes colors and codes
echo -e "\n\033[4;31mLight Colors\033[0m \t\t\033[1;4;31mDark Colors\033[0m"
echo -e "\e[0;30;47m Black \e[0m 0;30m \t\e[1;30;40m Dark Gray \e[0m 1;30m"
echo -e "\e[0;31;47m Red \e[0m 0;31m \t\e[1;31;40m Dark Red \e[0m 1;31m"
echo -e "\e[0;32;47m Green \e[0m 0;32m \t\e[1;32;40m Dark Green \e[0m 1;32m"
echo -e "\e[0;33;47m Brown \e[0m 0;33m \t\e[1;33;40m Yellow \e[0m 1;33m"
echo -e "\e[0;34;47m Blue \e[0m 0;34m \t\e[1;34;40m Dark Blue \e[0m 1;34m"
echo -e "\e[0;35;47m Magenta \e[0m 0;35m \t\e[1;35;40m DarkMagenta\e[0m 1;35m"
echo -e "\e[0;36;47m Cyan \e[0m 0;36m \t\e[1;36;40m Dark Cyan \e[0m 1;36m"
echo -e "\e[0;37;47m LightGray\e[0m 0;37m \t\e[1;37;40m White \e[0m 1;37m"
http://cafe.naver.com/ghson/397
'리눅스 > bash' 카테고리의 다른 글
nl (0) | 2013.04.03 |
---|---|
ext3 snapshot backup (0) | 2013.01.30 |
debian 한글 설정 (0) | 2013.01.28 |
문자별로 필드 구분시키기 (0) | 2013.01.21 |
bash timeout 래퍼 (0) | 2013.01.17 |