I need to run two commands. The first creates a file that is used as an input parameter to the second. I can run like this:
$ cmd1 p1 p2 > tmp.txt
$ cmd2 -i tmp.txt p3
The -i
parameter on cmd2
takes a filename. Is there a way I can do this in one line without creating the tmp.txt
file?
Try "process substitution" (that's what the Bash manual calls it)
cmd2 -i <(cmd1 p1 p2) p3
This also works the other way:
cmd2 -o >(cmd1 p1 p2) p3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With