I'm trying to write a script to send my music from my computer to my android phone via ssh but I'm having some difficulties. Here is the piece of code :
while read SONG
do
echo $SONG
ssh -qi ~/.ssh/key root@$ip [[ -f "/sdcard/Music/${SONG}" ]] && echo "File exists" || echo "File does not exist"
done < ~/.mpd/playlists/Blues.m3u
The goal is to check if the song is already in the phone, and if it's not I'll scp it (if it's there it is with the same relative path than in the .m3u file).
I always got sh: syntax error: 'Davis/Lost' unexpected operator/operand and I think it is because there is a space before Davis that I can't escape (the first $SONG is Geater Davis/Lost Soul Man/A Sad Shade Of Blue.mp3)
I also tried this, same result
while read SONG
do
echo $SONG
SONG="/sdcard/Music/$SONG"
echo $SONG
ssh -qi ~/.ssh/key root@$1 [[ -f "$SONG" ]] && echo "File exists" || echo "File does not exist"
done < ~/.mpd/playlists/Blues.m3u
Ideas welcome !!!