조회 수 32185 댓글 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
번호 분류 제목 날짜 조회 수 추천 수
296 업무 Mediaplayer ErrorCode 검색하기(.h파일) secret 2015.01.16 0 0
295 Android git log 옵션들 2015.01.09 29231 0
294 Android Eclipse에서 Android Full Source 확인하는 방법 secret 2015.01.07 0 0
293 LINUX 명령어 뒤의 옵션 자동완성 기능, complete 명령어 2015.01.06 8943 0
292 Android 카톡 SDK 의 안드로이드 기기 unique ID 얻기 방법 2015.01.02 15731 0
291 업무 CTS 테스트 가이드 secret 2015.01.02 0 0
290 Android How to use addr2line in Android (arm-linux-androideabi-addr2line.exe) 2014.12.31 11138 0
289 Android 안드로이드 소스에서 shell 명령어 실행하기 2014.12.30 7092 0
288 Android 간단한 Handler, Runnable 사용법 1 2014.12.30 28873 1
287 Android 맨날 까먹는 버튼 클릭 이벤트 핸들러 코드 2014.12.17 5897 0
286 업무 Ram Dump Parser 사용법 secret 2014.12.15 0 0
285 업무 ION memory allocator secret 2014.12.15 0 0
284 업무 SurfaceFlinger dump 하기 secret 2014.12.04 0 0
283 Android ion memory 사용량 확인하기 2014.12.03 8864 0
282 업무 Force To Crash Guide 강제로 Crash 내기 secret 2014.11.27 0 0
목록
Board Pagination ‹ Prev 1 ... 10 11 12 13 14 15 16 17 18 19 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


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

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

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5