Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run an adb shell command and remain in the shell?

Tags:

android

shell

adb

Does anyone know how to run commands from adb shell and remain in shell session? What I`m trying to achieve is to set aliases in adb shell.

I have tried the following without success

adb shell <<< "ls"

After executing this command indeed remain in shell, but cannot receive output of any further command.

I have also tried the following:

adb shell <<EOF
ls
EOF

with the same result.

like image 830
sashas Avatar asked Feb 21 '12 18:02

sashas


People also ask

How do I escape adb shell?

To exit adb and return to the system shell use the $q or $Q command. To stop the debugger press <Ctrl>D. NOTE: adb cannot be stopped by pressing the Quit or Interrupt key.


1 Answers

When you run:

adb shell ls

You are running this command currently outside of ADB.

First, you need to enter ADB:

adb shell

Once you enter ADB shell, you can continue to see output and input more commands.

ls
help

To exit ADB, simply type "exit" or hit "Ctrl + C"

like image 109
Jared Burrows Avatar answered Oct 28 '22 07:10

Jared Burrows