I regularly record audio files using my Android phone to WAV files to the internal storage of my phone. I'd like to write a Bash script to pull the most recent recorded file from my phone and move it to my Desktop. Here's what I've got so far:
adb shell find /storage/sdcard0/Sound\ Recordings/ | tail -1 | while read file ; do adb pull "$file" ~/Desktop/ done
However, this fails. It seems that ADB doesn't properly escape things and I get the following messages when trying to run the script:
' does not existstorage/sdcard0/Sound Recordings/20120817T065953.wav
It seems to ignore the double quotes and everything basically breaks when it tries to run, as it presumably sees 3 arguments rather than two, something like this:
adb pull /storage/sdcard0/Sound Recordings/20120817T065953.wav ~/Desktop/
How can I adjust my script to insert backslashes into my
$file variable where necessary? Is that the proper solution in this case?