
답변1
CentOS 6.10의 경우 다음 파일에는 SETCOLOR_SUCCESS, SETCOLOR_FAILURE 등에 대한 색상 구성이 포함되어 있습니다.
/etc/sysconfig/init
예:
# color => new RH6.0 bootup
# verbose => old-style bootup
# anything else => new style bootup without ANSI colors or positioning
BOOTUP=color
# column to start "[ OK ]" label in
RES_COL=60
# terminal sequence to move to that column. You could change this
# to something like "tput hpa ${RES_COL}" if your terminal supports it
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
# terminal sequence to set color to a 'success' color (currently: green)
SETCOLOR_SUCCESS="echo -en \\033[0;32m"
# terminal sequence to set color to a 'failure' color (currently: red)
SETCOLOR_FAILURE="echo -en \\033[0;31m"
# terminal sequence to set color to a 'warning' color (currently: yellow)
SETCOLOR_WARNING="echo -en \\033[0;33m"
# terminal sequence to reset to the default color.
SETCOLOR_NORMAL="echo -en \\033[0;39m"
아마도 이 정보와 이름을 사용하여 시스템에서 올바른 파일을 찾을 수 있을 것입니다 :)
답변2
이러한 정의는 에 있습니다 /etc/init.d/functions
.
스크립트는 /etc/sysconfig/init
관련 색상 정의가 포함된 를 얻으려고 시도합니다.
SETCOLOR_SUCCESS="echo -en \\033[0;32m"
SETCOLOR_FAILURE="echo -en \\033[0;31m"
SETCOLOR_WARNING="echo -en \\033[0;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
...원본 /etc/init.d/functions
파일은 다음과 같은 다양한 상태 메시지에 대한 기능을 정의합니다.
echo_success() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
echo -n $" OK "
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 0
}
...따라서 대신 뭔가를 내보내려면 OK
해당 문을 편집할 수 있고 echo
, 색상을 변경하려면 /etc/sysconfig/init
에서 해당 정의를 편집할 수 있습니다. 파일이 없으면 functions
스크립트가 색상 자체를 정의합니다( else
파일 존재 여부를 테스트하는 절 에서 init
).