4

I have a proprietary binary which stubbornly accepts two files as argument, first as input and second as output. I would like to

  1. build the first argument w/o creating a temporary file
  2. 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.

1 Answer 1

3
ThatBinary <(...) /dev/stdout
Sign up to request clarification or add additional context in comments.

1 Comment

Strangely enough, I can't redirect stdout of the script to a file. The error message read ``IOError: [Errno 20] Not a directory: '/dev/stdout' ''

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.