我用PuTTY 0.62通过SSH连接到QNX Neutrino。
我启用了“允许终端指定ASCI颜色”和“允许终端使用xterm 256色模式”。
如何让终端(qansi-m)为输出文本添加颜色?
答案 0 :(得分:1)
使用echo
时,您可以使用以下方法手动添加颜色:
图形再现代码如下:
Number Meaning
0 All attributes off (except charset (10, 11, 12))
1 Bold
2 Half intensity (default to cyan on color screen)
4 Underline (default to red on color screen)
5 Blink
7 Reverse
9 Invisible
10 Exit alternate char set (GR & GL are restored)
11 Enter PC-lower char set (GR & GL are ASCII; C0 & C1 are PC_LO except for ESC)
12 Enter PC-higher char set (GR, C1 & GL, C0 are PC_HI except for ESC)
21 Normal intensity (un-Bold)
22 Normal intensity (un-Half intensity)
24 Disable underline
25 Disable blink
27 Disable reverse
29 Visible
30-37 Set foreground color (30+color_number, see below)
39 Set foreground to saved
40-47 Set background color (40+color_number, see below)
49 Set background to saved
颜色代码如下:
colour_num Description
0 Black
1 Red
2 Green
3 Brown
4 Blue
5 Violet
6 Cyan
7 White
<强>语法:强>
{CSI}<setting1>;<setting2>m
八进制中的CSI是\ 0233,所以要用红色前景(31)打印粗体文本(1),你可以这样做:
echo "\023331;1m"
答案 1 :(得分:0)
您需要配置在Neutrino上运行的程序(包括shell)以发送必要的ANSI转义序列。 sshd
无法拦截和修改终端输出。