2011-09-27 56 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終端中測試過它。 –