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.
expect solution
adb-cmd
:Usage:
Tested in Ubuntu 16.04 host, Android O guest.
There was a similar question answered in the comments here.
In short, run the following from your terminal:
stty raw -echo ; ( echo "ls" && cat ) | adb shell ; stty sane
Note: without the
stty
magic, the command is piped toadb
and tab complete etc. is not recognized.When you run:
You are running this command currently outside of ADB.
First, you need to enter ADB:
Once you enter ADB shell, you can continue to see output and input more commands.
To exit ADB, simply type "exit" or hit "Ctrl + C"