I have a proprietary binary which stubbornly accepts two files as argument, first as input and second as output. I would like to
- build the first argument w/o creating a temporary file
- make binary write to stdout instead of a output file (second argument)
I solved the first issue with <(...) but not sure about the second argument.
I wrote a following script which looks like does everything as expected:
FILE1=$1
FILE2=$2
# checking that the files exist and other stuff
mkfifo myfifo
ThatBinary <( ... ) myfifo &
cat myfifo
The first argument for the binary is a combined Bash command which builds the first ``file''. The second argument is the named pipe to which the binary must write. All this is sent to background since writing to fifo blocks. Finally I print the named pipe's output to the stdout, as desired.
Is it possible to improve this command? Any hidden caveats? I am working with very large files (hundreds of thousands of text lines) and would love to be sure I miss nothing.