I use Thunar file explorer and pass pathname and filename to a script audioplay. audioplay runs play command on my android via ssh which plays a song.
audioplay script :: cat audioplay
if [ $# -eq 1 ] ; then
echo " Playing..." "$@"
sshpass -p $passwd ssh root@192.168.43.10 -p $port play "$@"
else
echo " No Input audio file."
fi
play script on my android :: cat play
#!/data/bin/bash
# Avoid linker errors due to libOpenSLES.so:
echo "File ::" "$@"
LD_LIBRARY_PATH= exec /data/bin/blob/play-audio "$@"
Problem is Path does not get passed correctly to play command over ssh. Path with multi spaces becomes single space and brackets create syntax error.
Example :
For file 18. Warriors.flac
present in /sdcard/Music/Imagine Dragons - Smoke Mirrors -Deluxe Edition-2015
Path sent to audioplay is correct :: /sdcard/Music/Imagine Dragons - Smoke Mirrors -Deluxe Edition-2015/18. Warriors.flac
But the path received by play script is wrong :: /sdcard/Music/Imagine Dragons - Smoke Mirrors -Deluxe Edition-2015/18. Warriors.flac
Multi spaces are turned into single space. Why ?
Then the main play-audio
binary gets only path /sdcard/Music/Imagine
upto first space only.
Example 2 ::
I tried with file having brackets :: 44. Go Tell Aunt Rhody -Resident Evil- (Short Version).flac
Path received by audioplay script is correct :: /sdcard/Music/44. Go Tell Aunt Rhody -Resident Evil- (Short Version).flac
But I get this error :: sh: syntax error: '(' unexpected
I tried with passing $@
$*
"$@"
and "$*"
. But none of them worked for me.