Android adb shell - ash or ksh?
Asked Answered
L

1

11

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?

Laure answered 14/8, 2012 at 10:13 Comment(2)
If it wasn't you that asked about this a few days ago in #!/bin/mksh on freenode then at least one other person ran into mksh on Android. But you're in some sort of emulator connecting to another device, and that documentation refers specifically to some debugging environment on an emulator? I'm not sure why you would expect it to have the same default shell. Anyway, glad to hear they chose a sane shell. Nothing approaching the size of mksh comes anywhere close.Bans
No, it wasn't me. The emulator is the AVD from Google. I would expect to have a consistent shell on the same version of the OS, unless they went backwards on Jelly Bean...Laure
R
32

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.)

Rhetorical answered 17/9, 2013 at 8:19 Comment(2)
Many, many thanks for taking the time to answer the question.Laure
I did a adb shell -v and saw your name (?) there. At first I thought is this some kind of "make shell"? Anw thank you for the useful information.Tenorrhaphy

© 2022 - 2024 — McMap. All rights reserved.