ADB shell running multiple commands in a row fails

Viewed 114

in the adb command i run is adb -s 127.0.0.1:21503 shell \"su cat /data/data/org.telegram.messenger/files/cache4.db\" get error /system/bin/ sh: su cat /data/data/org.telegram.messenger/files/cache4.db: not found which when I run each command again it works

As I run each command

adb -s 127.0.0.1:21503 shell
su
cat /data/data/org.telegram.messenger/files/cache4.db

Result for As I run each command: always show cache4.db file data to the screen

3 Answers

You can try: adb -s 127.0.0.1:21503 shell "cat /data/data/org.telegram.messenger/files/cache4.db"

You can use the following command:

adb -s 127.0.0.1:21503 shell "su; cat /data/data/org.telegram.messenger/files/cache4.db"

So the semicolon between su and cat command allows to execute them subsequently.

Try

adb -s 127.0.0.1:21503 shell su -c "cat /data/data/org.telegram.messenger/files/cache4.db"
Related