[GUIDE] Full bash shell with nano, tab completion, and color over ssh and adb

jmxp69

Senior Member
Feb 13, 2010
823
14
0
Posting this here because I think it will be of more interest to the tinkerers/devs than general users, if not, feel free to move it. I cobbled all of this together from various places on the web, but I think the credit for the binaries goes to Paul @ MoDaCo.

Nandroid before going any further!

Files you'll need:

For WiFi and CDMA SSH access - QuickSSHD (Download this from the Market. $1.50). I'm just going to assume if you're still reading, you know what this is for and how to use it. It's braindead simple. I think dropbear can be installed and configured manually, but for the $1.50...meh.

adb for tethered access.

The rest are zipped up here: terminfo, nano, bash, profile**

Unzip bashnano.zip onto your SDCard.
adb remount

From adb shell:

Install Terminfo:
cp -r /sdcard/terminfo /system/etc

Setup Bash:
cp /sdcard/bash /system/bin/bash_new
mv /system/bin/sh /system/bin/sh.old
ln -s /system/bin/bash_new /system/bin/sh
mv /sdcard/profile /sdcard/bash_profile (Thanks to jjvcuyler for finding adb bash profile location.)

Setup Nano:
cp /sdcard/nano /system/bin


I'm not sure if this setup will have any impact on sh scripts being used in the various ROMs, so use this at your own risk. I think it would kick ass to see this type of bash functionality baked into the custom ROMs.

If anybody would like to make this a flashable.zip, please do. I don't know how to do that yet.

Anyway, hope y'all find it useful.


**profile reflects a few personal choices for aliases and colors, but you can edit to your personal taste.
 
Last edited:

jmxp69

Senior Member
Feb 13, 2010
823
14
0
adb shell fires off bash, but it doesn't read profile from /etc. It's going to be a simple matter of figuring out where bash is looking for it. I just haven't found that out yet.

How do you like having full bash capabilities on EVO? Arrows/tab completion/color prompts, etc...

J
 

jjvcuyler

Member
Jun 12, 2010
32
6
0
Schenectady, NY
adb shell fires off bash, but it doesn't read profile from /etc. It's going to be a simple matter of figuring out where bash is looking for it. I just haven't found that out yet.

How do you like having full bash capabilities on EVO? Arrows/tab completion/color prompts, etc...

J
Copy profile to /sdcard/bash_profile
 
Last edited:

FusionX

Senior Member
Nov 15, 2008
669
158
0
NY
Posting this here because I think it will be of more interest to the tinkerers/devs than general users, if not, feel free to move it. I cobbled all of this together from various places on the web, but I think the credit for the binaries goes to Paul @ MoDaCo.

Nandroid before going any further!

Files you'll need:

For WiFi and CDMA SSH access - QuickSSHD (Download this from the Market. $1.50). I'm just going to assume if you're still reading, you know what this is for and how to use it. It's braindead simple. I think dropbear can be installed and configured manually, but for the $1.50...meh.

adb for tethered access.

The rest are zipped up here[/URL]: terminfo.zip, nano, bash, profile**

Unzip bashnano.zip onto your SDCard.
Unzip terminfo.zip (from inside bashnano.zip) onto your SDCard.
adb remount

From adb shell:

Install Terminfo:
cp -r /sdcard/terminfo /system/etc

Setup Bash:
cp /sdcard/bash /system/bin/bash_new
mv /system/bin/sh /system/bin/sh.old
ln -s /system/bin/bash_new /system/bin/sh
mv /sdcard/profile /sdcard/bash_profile (Thanks to jjvcuyler for finding adb bash profile location.)

Setup Nano:
cp /sdcard/nano /system/bin


I'm not sure if this setup will have any impact on sh scripts being used in the various ROMs, so use this at your own risk. I think it would kick ass to see this type of bash functionality baked into the custom ROMs.

If anybody would like to make this a flashable.zip, please do. I don't know how to do that yet.

Anyway, hope y'all find it useful.


**profile reflects a few personal choices for aliases and colors, but you can edit to your personal taste.

there is no terminfo.zip and there is nothing in terminfo directory from within the original zip... help?
 

FusionX

Senior Member
Nov 15, 2008
669
158
0
NY
adb shell fires off bash, but it doesn't read profile from /etc. It's going to be a simple matter of figuring out where bash is looking for it. I just haven't found that out yet.

How do you like having full bash capabilities on EVO? Arrows/tab completion/color prompts, etc...

J

is there a way to get tab completion through adb shell?
 

FusionX

Senior Member
Nov 15, 2008
669
158
0
NY
Yes. This works with adb shell. Just follow the directions in the OP.
i have and i do have everything done as stated in the OP, when i try tab completion via adb shell (phone tethered with usb) from my pc, it just puts in a tab, it doesn't complete.
 

jmxp69

Senior Member
Feb 13, 2010
823
14
0
Hmm....could be a dos thing with cmd.exe. I haven't tried on a PC, I'm on a Mac. adb shell via OSX works fine with tab completion. Try ssh'ing in instead with something like putty? Once you get ssh going, you don't need a cable.

Edit: Confirmed...tab completion doesn't work over Win cmd.exe and adb shell.
 

FusionX

Senior Member
Nov 15, 2008
669
158
0
NY
Hmm....could be a dos thing with cmd.exe. I haven't tried on a PC, I'm on a Mac. adb shell via OSX works fine with tab completion. Try ssh'ing in instead with something like putty? Once you get ssh going, you don't need a cable.

Edit: Confirmed...tab completion doesn't work over Win cmd.exe and adb shell.
Thanks for looking into it... I'll try getting it to work via linux instead. I guess ssh would be a solution, but i never turn wifi on.
 

webs05

Senior Member
Apr 27, 2009
496
34
0
Quad Cities
Is anyone able to do a NAND backup/restore after doing this? With Amon Ra's recovery I was unable to NAND backup.

EDIT:
I think this is a big negatory. I was just able to do a NAND backup, so maybe the error I got was a coincidence after applying these changes.
 
Last edited:

Vinny75

Senior Member
Jul 14, 2007
241
12
0
Anyone else noticing that the time is always displayed as GMT in the prompt? The date command gives the correct time for my timezone but the bash prompt always shows GMT
 

yunle

Member
Apr 26, 2011
35
15
0
Winnipeg
Posting this here because I think it will be of more interest to the tinkerers/devs than general users, if not, feel free to move it. I cobbled all of this together from various places on the web, but I think the credit for the binaries goes to Paul @ MoDaCo.

Nandroid before going any further!

Files you'll need:

For WiFi and CDMA SSH access - QuickSSHD (Download this from the Market. $1.50). I'm just going to assume if you're still reading, you know what this is for and how to use it. It's braindead simple. I think dropbear can be installed and configured manually, but for the $1.50...meh.

adb for tethered access.

The rest are zipped up here: terminfo, nano, bash, profile**

Unzip bashnano.zip onto your SDCard.
adb remount

From adb shell:

Install Terminfo:
cp -r /sdcard/terminfo /system/etc

Setup Bash:
cp /sdcard/bash /system/bin/bash_new
mv /system/bin/sh /system/bin/sh.old
ln -s /system/bin/bash_new /system/bin/sh
mv /sdcard/profile /sdcard/bash_profile (Thanks to jjvcuyler for finding adb bash profile location.)

Setup Nano:
cp /sdcard/nano /system/bin


I'm not sure if this setup will have any impact on sh scripts being used in the various ROMs, so use this at your own risk. I think it would kick ass to see this type of bash functionality baked into the custom ROMs.

If anybody would like to make this a flashable.zip, please do. I don't know how to do that yet.

Anyway, hope y'all find it useful.


**profile reflects a few personal choices for aliases and colors, but you can edit to your personal taste.
I followed the steps exactly, but end up with "- exec '/system/bin/sh' failed: Permission denied (13) -" while typing "adb shell" in a windows or linux terminal. I cannot recover the original sh because the root is lost, and I cant root my phone anymore probably because something wrong with the new sh. Any idea how to fix this?

EDIT: Acutally nevermind. adb shell works in recovery mode. but still, not sure why the modified sh doest work for me
 
Last edited:

CNexus

Senior Member
May 17, 2012
9,009
13,993
263
~/android

Attachments

Last edited: