Some commands only output to stdout.Some tools only work on files.Is there a command that can glue those together?Contrived simple example:diff $(echo 1 | stdout-to-temp-file) $(echo 2 | stdout-to-temp-file)My actual use case; Current workaround:git show HEAD:$1 > /tmp/left && meld /tmp/left $1My actual use case; Desired:meld $(git show HEAD:$1 | stdout-to-temp-file) $1I'd use this in a few other situations too (i.e. I'm not looking for a git or meld only fix).
Create a temporary file from a stdout redirect or pipe
shell;io redirection;pipe
You could use < to redirect your output to stdin.I don't know how meld works, but about your diff example, here's how it would work:Using tempfiles $ cmd1 > file1.tmp$ cmd2 > file2.tmp$ diff file1.tmp file2.tmpWithout tempfiles$ diff <(cmd1) <(cmd2)Note that syntax may vary a bit according to the shell you're using (I'm using ksh88).