Suppose the application can only open files via command line arguments, how would i go about randomizing a list of file names/paths to accomplish this?
I thought this should be fairly easy but apparently spaces make it more complicated than it should be.
An example:
a.mp3
b.mp3
with space.mp3
When i try $(ls | shuf)
the space is not escaped yielding something like with space.mp3 b.mp3 a.mp3
.
Using the quote option -Q
does not help either because the command substitution escapes the quotes resulting in the following: \"with space.mp3\" \"a.mp3\" \"b.mp3\"
Similarly the escapes of -b
get escaped as well: with\\ space.mp3 a.mp3 b.mp3
Something like find
's -exec <application> {} \+
without the finding would be perfect...