2015-05-21 23 views
0

我想用whiptail顯示一個包含度符號的消息。我試過這些,但沒有一個看起來有效:linux whiptail帶有度符號

whiptail --title "Weather Info" --msgbox '\N{U+00B0}' 17 60 3>&1 1>&2 2>&3 
whiptail --title "Weather Info" --msgbox "\N{U+00B0}" 17 60 3>&1 1>&2 2>&3 
whiptail --title "Weather Info" --msgbox "\xc2\xb0" 17 60 3>&1 1>&2 2>&3 
whiptail --title "Weather Info" --msgbox '\xc2\xb0' 17 60 3>&1 1>&2 2>&3 

難道不可以這樣做嗎?

回答

0

無論是whiptail還是bash都沒有提供有關此案件逃逸的幫助。你可以使用bash的內置回聲來驗證。

如果您使用文字符號的程度不逃逸的任何幫助,作品:

whiptail --title "Weather Info" --msgbox '°' 17 60 3>&1 1>&2 2>&3 
+0

其實猛砸4支持'printf的「\ u00B0''如果你希望你的腳本是便攜純ASCII和健壯性。不過,你需要一個像' - msgbox「$(printf'\ uB0')」'這不是非常好的elegat的進程替換。 – tripleee

+0

我看到了(可移植性的一半,因爲它仍然是一個bash特有的功能)。 –

+0

你好,對不起,我幾個星期沒上線了。我嘗試了printf方式,但它不起作用。度符號顯示爲pattersn,即終端中塊光標的大小。這是一個鏈接到輸出:http://ibin.co/23nV4khMxKwV。 –