MilleB
MilleB

Reputation: 1580

ADB echo gives "No such file or directory"

I'm trying to write text to a file with adb and stumble on some problems.

If I do it in two steps, like this:

adb shell 
echo "hello" > /sdcard/temp/hello.txt

it works. But if I try to do it on one row like this:

adb shell echo "hello" > /sdcard/temp/hello.txt

I get "No such file or directory". Must I change the path in some way? I'm going to call on this from another script I have must have it on one row.

Upvotes: 2

Views: 10887

Answers (1)

Adam S
Adam S

Reputation: 16414

You need to quote the entire script you'd like executed:

adb shell "echo \"hello\" > /sdcard/temp/hello.txt"

Upvotes: 5

Related Questions