问题
The Android online documentation Android Debug Bridge says "Adb provides an ash shell". Sure enough, if I adb shell
to an AVD emulator I get ash which is basically a cut-down Bourne shell.
However, if I connect to a couple of remote devices, one an HTC telephone and the other an ASUS Transformer Prime tablet, they both have a version of the Korn shell, which gives: KSH_VERSION='@(#)MIRBSD KSH R39 2010/08/24'
. Although MIRBSD KSH is not a full-blown AT&T Korn shell, it is still a lot more powerful than ash.
The emulator is running Jelly Bean, and both devices are using ICS. Doing a bit more digging, it looks like ash was in Gingerbread but mirbsd ksh in Honeycomb.
So, can someone confirm that the Android online documentation is wrong, and that the emulator is running an out-of-date shell? Or is it that suppliers are implementing their own?
回答1:
I’m the author of mksh (The MirBSD Korn Shell) and have submitted it for inclusion into Android at roughly the 1.6 time after having had experimental builds of mksh for Android 1.5 already.
It took quite a while for this to be accepted, although Android-x86 used it very early. At first we had a configurable switch where the board config would determine whether ash or mksh were used; Google agreed that only one should be shipped on a device. Around the time when 2.4 was prepared (which was never released), the hardware board configs used mksh, whereas the emulator config used ash, in order to make sure to not introduce mksh-specifics in case they should want or need to go back to ash. 2.4 never got released, and I don’t know what was used on the 3.0 series, but since Android 4.0 mksh is its standard system shell.
mksh even got a security review by Geremy Condra, and we (both the AOSP/Google people as well as me) regularily push updates to the code. Fun fact: they didn’t intend to ship a shell on the phones initially at all but agreed to ship mksh because they already had shipped devices with a shell on them by then, so it became part of the published API. The #1 feature Android developers like in mksh, over ash, is tab completion.
Looking at the online docs now, it seems that they removed the ash reference. They’re now just not explicit on which shell is available. (They did agree to link to the mksh homepage in the online docs – I submitted a patch for that – so that users can RTFM and provide bug reports and other feedback.)
来源:https://stackoverflow.com/questions/11950131/android-adb-shell-ash-or-ksh