adb shell - simulate “tail” command?

1.9k views Asked by At

Is it possible to simulate "tail -f" on android?

I'd like to write all the new data in one file into another file, just like:

"tail -f n 0 a.txt > b.txt"

1

There are 1 answers

0
Jesse On

Yes it is possible with some shell hackery, no busybox needed. Try this:

adb shell "(cat > /dev/null; while true; do cat; sleep 1; done) < a.txt > b.txt"

Remove the initial cat to simulate a regular tail -f.

(related: https://stackoverflow.com/a/44288388/893755)