Alternative use of JS and Shell

by Ricardo Fernández Serrata

Version 1 (April 18, 2022)

Download (179 downloads)

Shows that processing can be done in JS and SH instead of AM, which decreases the block count dramatically.

The default expression to evaluate is 3x + 1 (where x is input), but you can change it to anything valid depending on language.

JS and MirBSD Korn Shell (MKSH) are very different languages, some expressions will have different valid syntax or the same syntax but different interpretation. In this example I show you something they have in common, for the sake of simplicity.

The result of some arithmetic can be vastly different, because MKSH uses 32bit integers that do wrap-around on overflow.

Text processing can be done in both, but JS is extremely better at it than AM and MKSH combined. Math is faster in MKSH, but there are no pow() nor log() functions.

The shell can do more things than just processing, it can do file operations like creating, editing, deleting, renaming, and moving files and directories. With curl command, you can do HTTP requests. With root (or ADB), it can also change any system setting and install more cmds.

Dialogs have more latency than shell, but the shell has more latency than AM even though some computations are faster in the shell.

MirBSD Korn Shell Manual:

List of installed executable files and symlink binaries for each Android version:

JS documentation can be found in the official Mozilla Developer Network:


4.8 average rating from 6 reviews

5 stars
4 stars
3 stars
2 stars
1 star

Rate and review within the app in the Community section.