Categories
adb android pipe shell

Piping output from 1 command to other command in an adb shell command line

I wish to send an adb shell command to an Android device that pipes output from 1 command to other command, but when I try to do that, only the 1st command is executed on the device, and the 2nd one is executed on the host machine. Here’s what I tried:

adb shell command1 | command2

command1 is executed on the device, and command2 on the host machine.

How can I get this to work properly?

Thanks!