조회 수 32194 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
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 offcolorBold oncolor
0;30Balck1;30Dark Gray
0;31Red1;31Dark Red
0;32Green1;32Dark Green
0;33Brown1;33Yellow
0;34Blue1;34Dark Blue
0;35Magenta1;35Dark Magenta
0;36Cyan1;30Dark Cyan
0;37Light Gray1;30White

ColorForegroundBackground
black3040
red3141
green3242
yellow3343
blue3444
magenta3545
cyan3646
white3747


$ echo -e '\E[47;34m'"\033[1mE\033[0m"
흰색배경에 파란색 글씨로 m이라고 출력됨


echo -e "\033[COLORm Sample text"

The "\033[" begins the escape sequence.You can also use "\e[" instead
of "\033[". COLOR specifies a foreground color, according to the table
above.The "m" terminates escape sequence, and text begins immediately
after that.

Note: With an echo, the -e option enables the escape sequences.You can
also use printf instead of echo.


printf "\e[COLORm sample text\n"

To print Green text

echo -e "\033[32m Hello World"
             or
printf "\e[32m Hello World"

정상으로 돌아오려면
echo -e "\033[0m"


[ 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"



[ANSI 문자]

DecabbrcmdechoNoteDecabbrcmdechoNoteDecabbrcmdechoNote
0NUL^@x

12FF^L

24CAN^X

1SOH^A

13CR^Mx줄바꿈25EM^Y

2STX^B

14SO^N

26SUB^Zx

3ETX^C

15SI^O

27ESC^[

4EOT^D

16DLE^P

28FS^\

5ENQ^E

17DC1^Q

29GS^]

6ACK^F

18DC2^R

30RS^^

7BEL^G소리

19DC3^S

31US^_

8BS^H지우기

20DC4^T

32SP공백공백공백
9HT^Ix21NAK^U

127DEL^?

10LF^Jx

22SYN^V

11VT^K

23ETB^W

x 사용할 수 없거나 Null 값으로 처리됨.
* ASCII Code 8 은 BackSpace 로 배치 파일에서 사용되면 의미 그대로 앞의 한 글자를 지웁니다.
* 명령 프롬프트의 Echo 출력 결과는 Color F0 으로 설정한 후 캡쳐한 것입니다.
TAG •

Dreamy의 코드 스크랩

내가 모으고 내가 보는

List of Articles
번호 분류 제목 날짜 조회 수 추천 수
281 Android L버전 32/64bit tip 및 multi user 관련 adb 명령어 2014.11.18 8443 0
280 LINUX shell 에서 background로 명령어 수행하기 2014.11.11 37127 0
279 LINUX 리눅스에서 특정작업 or 명령어 반복하기 Crontab 2014.11.10 10332 0
278 LINUX [Shell Script] 쉘 스크립트에서 getopt 사용하는 법 2014.11.09 16983 0
277 LINUX [Shell Script] 쉘 스크립트에서의 사칙연산과 문자열 자르기 2014.11.01 81829 0
276 C# C# 배열 array 2014.10.22 12578 0
275 Android 에러 넘버 ErrorNo in Linux 2014.10.14 9392 0
274 일반 배치파일(bat)에서 날짜-시간을 파일 명으로 쓰기 2014.10.10 29274 0
273 Android logcat, main+kernel로그 합치는 로그 2014.10.07 10355 0
272 LINUX [Shell Script] 파일을 한줄씩 읽어오기 2014.10.03 56446 0
271 LINUX [Shell Script] Shell 스크립트에서 매개변수 치환 2014.09.23 29690 0
270 LINUX [Shell Script] 쉘 스크립트 개요 2014.09.23 28012 0
269 LINUX [Shell Script] 리눅스 쉘(Shell) 스크립트 2014.09.23 86879 0
» LINUX [Shell Script] 글자 속성, 색깔 지정 2014.09.23 32194 0
267 Android tag 없이 repo sync 후 특정 tag 만 당겨오기 2014.09.18 11432 0
목록
Board Pagination ‹ Prev 1 ... 11 12 13 14 15 16 17 18 19 20 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5