I want to play all the .mp3 files within a directory using vlc, so I do something like this:
vlc $(find ~/Documents/music -name "*.mp3" -exec "echo \"{}\"" \;)
The issue is that I get "vlc: unknown option or missing mandatory argument `-D'". Presumably a parsing issue.
So let's do it file by file:
echo $(echo $(find ~/Documents/music -name "*.mp3" -exec echo "\"{}\" \n " \;) | head -n 1)
I get:
"/home/XXX/Documents/music/My Folder/1 - track/the name of track.mp3"
And when I run:
vlc "/home/XXX/Documents/music/My Folder/1 - track/the name of track.mp3"
It works.
But when I run
vlc $(echo $(find ~/Documents/music -name "*.mp3" -exec echo "\"{}\" \n " \;) | head -n 1)
I get:
cannot open file /home/XXX/the (No such file or directory)
Which would make sense if the arguments to vlc weren't properly quoted. But they are? So why is it being passed into vlc as an unquoted string?