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?
You can run the shell inside rlwrap:
rlwrap adb shell
I prefer to run it in an Emacs shell buffer myself, I recommend this if you're not allergic to Emacs. Emacs is also nice for running adb logcat
: you get a searchable history and the messages are updated as they come, and you can easily put interesting patterns in color (M-x highlight-regexp
and friends).
rlwrap
gives be readline edition. I do seem to recall rlwrap
not working with a previous SDK version, but I don't remember which version. –
Southsoutheast If you're talking about real device (not emulator), you should try some non-official firmwares, such as Cyanogenmod - it includes much better binary tools, such as much more featureful shell, sane set of regular UNIX tools, ssh server, etc.
If you're talking about emulator, you can extract these binaries from firmwares and push it into emulator as is (using a memory card image).
If Ctrl-p still gives you previous history entries, then it's possible that the arrow keys became unbound for some reason. Try this:
bind '"\e[A": previous-history'
bind '"\e[B": next-history'
If that makes the arrow keys work, you can make it persistent by adding these two lines to /etc/inputrc
or ~/.inputrc
:
"\e[A": previous-history
"\e[B": next-history
© 2022 - 2024 — McMap. All rights reserved.