我一直在尝试使用类似的东西将文件从我的Android设备移动到我的osx机器:adb shell tar -c directory_to_copy | tar -x.似乎远程tar正在工作,但文件被破坏的方式.经过一番游戏,我发现:
似乎adb shell命令将LF转换为CRLF:
% adb shell 'cd /mnt/sdcard;echo hi>a.bin'
% adb shell 'cd /mnt/sdcard;cat a.bin' | hexdump -C
00000000 68 69 0d 0a |hi..|
00000004
% adb pull /mnt/sdcard/a.bin
0 KB/s (3 bytes in 0.457s)
% hexdump -C a.bin
00000000 68 69 0a |hi.|
00000003
Run Code Online (Sandbox Code Playgroud)它看起来是服务器或守护进程导致的而不是客户端(请参阅len = 4):
% ADB_TRACE=1 adb shell 'cd /mnt/sdcard;cat a.bin'
[... snip ...]
system/core/adb/commandline.c::read_and_dump():read_and_dump(): post adb_read(fd=3): len=4
[... snip ...]
Run Code Online (Sandbox Code Playgroud)我猜这个守护进程在windows用户的shell命令中进行了那种翻译.
我的问题是:
谢谢!