简体   繁体   中英

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". Is this some keyboard shortcut for the arrow keys?

I am currently imagining it is something like CTRL + ? + A since CTRL + C produces "^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 + ? + A since CTRL + C produces "^C".

Also correct. It is Ctrl [ , just as shown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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