2011-09-27 122 views

回答

3
$ echo -e "this is a sentence \0 test123" 
this is a sentence test123 

The null here ^^ IS NOT visible

$ echo -e "this is a sentence \0 test123" | cat --show-nonprinting 
this is a sentence ^@ test123 

But it IS here ^^

但也许你并不想这样一个脚本?

2

与中止命令(按Ctrl - Ç),在大多数终端只是打按Ctrl - @(我的键盘上使用转移的)。

3

在Linux中,任何特殊字符可以被逐字按Ctrl键 + v后跟实际符号插入在终端上。 null通常是^@其中^代表Ctrl@对于键盘布局上的任何组合,产生@

所以我的键盘上我做的:按Ctrl +v其次按Ctrl ++ @我得到一个^@符号具有显赫的背景颜色。这意味着它是一个特殊字符,而不仅仅是^@输入。

+0

你在说'Vim'。阿斯克谈论'壳'。 Vim是唯一一个接受NUL组合的人,也是唯一一个为其控制字符着色的人。 –

+1

@ B1KMusic对不起,我不是在谈论'Vim'。我在谈论普通的'xterm','bash'和'zsh'。 – Unode

+0

不,不在bash中工作。只有zsh和vim。我在tty,xterm,st,rxvt和gnome终端中测试过它。 –