Because using the built-in mksh and editing text using pipes and redirects like a caveman is insanity!
Luckily, a kind stranger has already saved us the headache of cross-compiling :)
https://github.com/bnsmb/binaries-for-Android
Note
All commands displayed here are run inside ADB shell.
-
cdto the specialshell-owned path. This will be our$HOME1cd /data/local/tmp -
Get the
bashandvimbinaries from binaries-for-Androidbinaries="https://github.com/bnsmb/binaries-for-Android/raw/refs/heads/main/binaries" curl -LO $binaries/bash curl -L -o vim $binaries/vim-9.2 # select whichever version is available
-
Make them executable and move to
bin/chmod +x bash vim mkdir bin mv bash vim -t bin/
-
Get
.bashrcand.vimrcfrom this repodots="https://github.com/SuggonM/dotfiles/raw/refs/heads/adb-shell" curl -LO $dots/.bashrc curl -LO $dots/.vimrc curl -LO $dots/_bash chmod +x _bash
-
Get the Vim runtime
curl -LO https://codeload.github.com/vim/vim/zip/refs/heads/master unzip master 'vim-master/runtime/*' mkdir -p sysroot/usr/share/vim mv vim-master/runtime sysroot/usr/share/vim rm -r master vim-master -
Run the bash wrapper to enter bash
/data/local/tmp/_bash
Footnotes
-
Unlike the name
tmpsuggests, it's persistent. ↩
terminal-capture.mp4