11

I recently upgraded to the new Android SDK and I noticed something very very bothering. It seems it is no more possible to use the command history in the shell. Are you noticing the same? The Android shell seems horrible to me, but at least, in the last SDK, I had the command history. Now, it seems that pressing the up/down arrow, result in some codes written on the prompt (something like ^[[A, ^[[B etc...). I tried to read a little bit around but I found very few asking this a zero answers. Any idea why this happens and how to solve this?

4

3 回答 3

3

您可以在rlwrap内运行 shell :

rlwrap adb shell

我更喜欢自己在 Emacs shell 缓冲区中运行它,如果您对 Emacs 不过敏,我建议您这样做。Emacs 也很适合运行adb logcat:您可以获得可搜索的历史记录,并且消息会随着消息的出现而更新,并且您可以轻松地将有趣的模式涂上颜色(M-x highlight-regexp和朋友)。

于 2010-12-18T15:48:38.563 回答
1

如果您谈论的是真实设备(不是模拟器),您应该尝试一些非官方固件,例如Cyanogenmod - 它包含更好的二进制工具,例如功能更强大的 shell、健全的常规 UNIX 工具集、ssh 服务器、等等

如果您正在谈论模拟器,您可以从固件中提取这些二进制文件并将其按原样推送到模拟器中(使用存储卡映像)。

于 2010-12-18T21:53:56.637 回答
0

如果Ctrl-p仍然为您提供以前的历史记录条目,那么箭头键可能由于某种原因变得未绑定。尝试这个:

bind '"\e[A": previous-history'
bind '"\e[B": next-history'

如果这使箭头键起作用,您可以通过将这两行添加到/etc/inputrcor来使其持久化~/.inputrc

"\e[A": previous-history
"\e[B": next-history
于 2010-12-18T15:09:03.330 回答