I\'m working with a command line utility that requires passing the name of a file to write output to, e.g.
foo -o output.txt
The only thing
The most convenient way of doing this is by using process substitution. In bash the syntax looks as follows:
foo -o >(other_command)
(Note that this is a bashism. There's similar solutions for other shells, but bottom line is that it's not portable.)
You can do the above explicitly / manually as follows:
Create a named pipe using the mkfifo command.
mkfifo my_buf
Launch your other command with that file as input
other_command < my_buf
Execute foo and let it write it's output to my_buf
foo -o my_buf
/dev/stdoutYou can also use the device file /dev/stdout as follows
foo -o /dev/stdout | other_command