So, I have a problem very similar to Bash: How to read one line at a time from output of a command?, I am doing:
while read path; do mplayer $path; done < <(find-me-random-mp3s)
find-me-random-mp3s | while read path; do mplayer $path; done
find-me-random-mp3s outputs file paths each on a new line. The problem starts when
mplayer runs, it starts consuming lines from
find-me-random-mp3s output, i.e. lines that were supposed to be filled inside the
path variable on each iteration.
I went on with this dirty fix:
find-me-random-mp3s | while read path; do cat /dev/null | mplayer $path; done
But I don't really like it, it blocks my terminal interaction with mplayer too.
Is there any alternative method that I can use in such case?