简体   繁体   中英

How to use Bash in adb (android ) instead of Shell?

I'm currently using adb terminal to access my database files. However, I can only access the terminal using this:

./adb shell

I would like to switch from sh to bash as it is much more convenient for some shortcuts. How do I do that?

i dont think adb have bash options , if you type adb help , you will see options for shell and not for bash

shell:
 shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]
     run remote shell command (interactive shell if no command given)
     -e: choose escape character, or "none"; default '~'
     -n: don't read from stdin
     -T: disable PTY allocation
     -t: force PTY allocation
     -x: disable remote exit codes and stdout/stderr separation
 emu COMMAND              run emulator console command

May be if you can share, what specific difficulties you are facing in running the shortcut or command

However if you still wanted to use adb with bash , you can have a look on below link

https://android.stackexchange.com/questions/19315/how-to-set-bash-as-default-shell

Answered here

Found the proper & simple way from a Linux box:

adb shell -t bash -i

You logon directly via in interactive way.

To not having to remember this command all the times, I personally use an alias, simply add this to your ~/.bashrc on Linux box:

alias adb_shell='adb shell -t bash -i'
source ~/.bashrc

Then all is configured, simply run

adb_shell

and enjoy all bash features like tab completion and anything. \\o/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM