作法 vi cross.h
echo -e “�33[32m”
echo wow
echo -e “�33[0m”
echo wow
第一行除了 32 外其它字串 echo -e �33[ m 皆是必備的
32 代表前景顯示綠色
0 代表回復預設顏色
搭配前景背景 → echo -e “�33[41;32m“,使用分號分隔,前後順序沒有差別
ANSI 顏色碼,從 man 查來的 → man 5 dir_colors
0 to restore default color
1 for brighter colors
4 for underlined text
5 for flashing text
30 for black foreground
31 for red foreground
32 for green foreground
33 for yellow (or brown) foreground
34 for blue foreground
35 for purple foreground
36 for cyan foreground
37 for white (or gray) foreground
40 for black background
41 for red background
42 for green background
43 for yellow (or brown) background
44 for blue background
45 for purple background
46 for cyan background
47 for white (or gray) background
留言