I want to write a bash script that receives a list of files through a pipe, writes a tempfile and then starts a program (qiv - an image viewer) with this tempfile.
find . -atime 2 | piped_qiv
[receive file list through pipe] > /tmp/qiv_temp
qiv -fm -F /tmp/qiv_temp
qiv $(find . …)
find . -atime 2 -print0 | xargs -0 my_command
-print0 will make
find print each found file seperated by NUL (
-0 will make xargs read each line separated by the same.
Alternative if you want to pass a file you can use process substitution:
% echo <(ls) /dev/fd/63
And in your case:
qiv -fm -F <(my_command)
Or reading from stdin:
qiv -fm -F <(cat)