Reputation: 1554
I'm trying to catch an output of bash patch
on stdout, but I receive an error:
patch -o- some/file
patch: can't output patches to standard output
Can I get the patch result on stdout?
Upvotes: 3
Views: 6758
Reputation: 298
There are a couple of ways to do this.
Use a temporary file to collect the patched file, cat the temp file and then delete it. A one-liner would be:
patch fileToPatch patch.diff -o temp.out;cat temp.out;rm temp.out
Send the output directly to /dev/tty
:
patch fileToPatch patch.diff -o /dev/tty
Upvotes: 7
Reputation: 49
You can use "-o -" to explicitly redirect the output to stdout:
patch fileToPatch patch.diff -o -
Hope it helps
Upvotes: 3