Shell manipulation to get a file from android -
i have android device need obtain log file from. log file changes every time it's created, cannot hardcode name of file script.
what thinking, doing
adb shell "rm /data/trace/*"
to delete file in folder before generate log file. maybe do
adb pull "/data/trace/`adb shell ls /data/trace/`"
what think execute ls command it'll list file there. , rest of cause pull "/data/trace/file".
however, doesn't work.
i error:
' not existdata/trace/log.8290
does have tips on how this?
thanks.
so turns out there's added carriage return '\r' @ end messes syntax.
this did solve problem.
test_file=`adb shell ls /data/trace/`; test_file2=`echo $test_file | tr -d '\r'`; echo "grabbing $test_file2"; adb pull "/data/trace/$test_file2";
this strips carriage return off file name , makes possible can use in adb pull code.
cheers.
Comments
Post a Comment