Linux终端彩色输出

echo -en ‘E[37;44;1m’
                 ^^ ^^   ^^   ^
                 |    |    |    |
                 |    |    |    |——是否高亮
                 |    |    |————背景颜色
                 |    |——————前景颜色
                 |————————转义序列标志,或者"33["

#!/bin/bash
# esc.sh:
#   显示 ANSI 的彩色
#
esc="33["
echo -n " 40 41 _ 42 43"
echo " 44 45 46 _ 47 "
for fore in 30 31 32 33 34 35 36 37; do
line1="$fore "
line2="    "
for back in 40 41 42 43 44 45 46 47; do
    line1="${line1}${esc}${back};${fore}m Normal ${esc}0m"
    line2="${line2}${esc}${back};${fore};1m Bold    ${esc}0m"
done
echo -e "$line1n$line2"
done




http://www.linuxfocus.org/English/May2004/article335.shtml