I tried the following command find ~/dir1 *.m4a | play
Directory dir1 has exactly 1 m4a file in it and I'd like it to be played Yet I get a usage error from play. Why?
What you wrote instructs the output of the find command (an m4a file) to be send over as the input to the next command, play.
Now, I have no idea what that play exactly is, but most likely, it's syntax is of the type:
play filename
But what you wrote translates to:
play < "filename"
So, what you probably want to do is use a command like xargs, which will do exactly that:
find ~/dir1 *.m4a | xargs play
Which results in:
play foundfile1 foundfile2 ...
May be play don't use STDIN so you have to use xargs
find ~/dir1 \*.m4a |xargs play
find. I have updated your answer.
playaccepts files from its STDIN?