2015年5月5日 星期二

Backspace as ^H?!使用Terminal時退後刪除變成脫字符號H

正要使用鳥哥的範例寫Shell時發現...以下這段

read -p "Please input your first name: " firstname  # 提示使用者輸入

read -p "Please input your last name:  " lastname   # 提示使用者輸入

echo -e "\nYour full name is: $firstname $lastname" # 結果由螢幕輸出

執行時:

Please input your first name: 1234^H^H^H
Please input your last name:  1234
想要刪除打Backspace變成^H,菜鳥工程師我查了Wiki

^H[edit]

Pressing the backspace key on a computer terminal would generate the ASCII code 08, BS or Backspace, a control code which would delete the preceding character. That control code could also be accessed by pressing Control-H, as H is the eighth letter of the Latin alphabet. Terminals which did not have the backspace code mapped to the function of moving the cursor backwards and deleting the preceding character would display the symbols ^H (caret, H) when the backspace key was pressed. Even if a terminal did interpret backspace by deleting the preceding character, the system receiving the text might not. Then, the sender's screen would show a message without the supposedly deleted text, while that text, and the deletion codes, would be visible to the recipient. This sequence is still used humorously for epanorthosis by computer literates, denoting the deletion of a pretended blunder, much like a strikethrough.
Example:
Be nice to this fool^H^H^H^Hgentleman; he's visiting from corporate HQ.[4]
(Epanorthosis也是一個有意思的字,可以參考http://en.wikipedia.org/wiki/Epanorthosis)

發現了一個亮點,這個刪除的脫字符號原來可以拿來惡搞haha,把他當作strikethrough...
上面的例句,你看出笑點了嘛?

總而言之,改掉設定就可以正常打Backspace了
請看下圖,使用ASCII 127



沒有留言:

張貼留言