echo 명령으로 출력하는 텍스트 글자색 변경 예제

 

< bash script 예제 >

#!/bin/bash

COLOR_BLACK_1="\033[0;30m"
COLOR_RED_1="\033[0;31m"
COLOR_GREEN_1="\033[0;32m"
COLOR_YELLOW_1="\033[0;33m"
COLOR_BLUE_1="\033[0;34m"
COLOR_MAGENTA_1="\033[0;35m"
COLOR_CYAN_1="\033[0;36m"
COLOR_GRAY_1="\033[0;37m"
COLOR_WHITE_1="\033[0;38m"

COLOR_BLACK_2="\033[1;30m"
COLOR_RED_2="\033[1;31m"
COLOR_GREEN_3="\033[1;32m"
COLOR_YELLOW_2="\033[1;33m"
COLOR_BLUE_2="\033[1;34m"
COLOR_MAGENTA_2="\033[1;35m"
COLOR_CYAN_2="\033[1;36m"
COLOR_GRAY_2="\033[1;37m"
COLOR_WHITE_2="\033[1;38m"

COLOR_END="\033[0m"

echo -e "$COLOR_BLACK_1 BALCK (dark)   $COLOR_BLACK_2 BALCK (bright) $COLOR_END"
echo -e "$COLOR_RED_1 RED (dark)     $COLOR_RED_2 RED (bright) $COLOR_END"
echo -e "$COLOR_GREEN_1 GREEN (dark)   $COLOR_GREEN_2 GREEN (bright) $COLOR_END"
echo -e "$COLOR_YELLOW_1 YELLOW (dark) $COLOR_END" "$COLOR_YELLOW_2 YELLOW (bright) $COLOR_END"
echo -e "$COLOR_BLUE_1 BLUE (dark)    $COLOR_BLUE_2 BLUE (bright) $COLOR_END"
echo -e "$COLOR_MAGENTA_1 MAGENTA (dark) $COLOR_MAGENTA_2 MAGENTA (bright) $COLOR_END"
echo -e "$COLOR_CYAN_1 CYAN (dark)    $COLOR_CYAN_2 CYAN (bright) $COLOR_END"
echo -e "$COLOR_GRAY_1 GRAY (dark)    $COLOR_GRAY_2 GRAY (bright) $COLOR_END"
echo -e "$COLOR_WHITE_1 WHITE (dark)   $COLOR_WHITE_2 WHITE (bright) $COLOR_END"

< 실행결과 >

'자료 창고 > Linux Program' 카테고리의 다른 글

네트워크 트랙픽 확인 nethogs 사용법  (0) 2023.08.09

+ Recent posts