简体   繁体   English

为什么在bash中运行某些东西时按箭头键会产生“ ^ [[A ^ [[C ^ [[B ^ [[D]”?

[英]Why does pressing the arrow keys while something is running in bash produce “^[[A^[[C^[[B^[[D”?

Let's say you run the command 假设您运行命令

find . -iname bob

While it is running, pressing various letters on your keyboard inserts it before the standard output of the next line produced by "find". 在运行时,按键盘上的各种字母会将其插入到“查找”产生的下一行的标准输出之前。 However, pressing the up arrow produces "^[[A". 但是,按向上箭头会产生“ ^ [[A”。 Is this some keyboard shortcut for the arrow keys? 这是箭头键的某些键盘快捷键吗?

I am currently imagining it is something like CTRL + ? 我目前正在想像是CTRL +吗? + A since CTRL + C produces "^C". + A,因为CTRL + C会产生“ ^ C”。

Is this some keyboard shortcut for the arrow keys? 这是箭头键的某些键盘快捷键吗?

Correct. 正确。 The terminal generates these character sequences when extended keys are pressed, and it is up to the software (eg readline) to interpret these sequences appropriately. 当按下扩展键时,终端会生成这些字符序列,这取决于软件(例如,读取行)来适当地解释这些序列。

I am currently imagining it is something like CTRL + ? 我目前正在想像是CTRL +吗? + A since CTRL + C produces "^C". + A,因为CTRL + C会产生“ ^ C”。

Also correct. 也正确。 It is Ctrl [ , just as shown. 如图所示,它是Ctrl [

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM