5

Is there a way to pipe the diff output into patch? The -i parameter is for specifying a diff file, but I just want to do it more dynamically, since I will be updating regularly against a directory that changes frequently.

For instacne, something along the lines of

patch -b | diff -Nub . /current-files

?

The man file says

-i patchfile  or  --input=patchfile
Read the patch from patchfile.  If patchfile is -, read from standard input, the default.

But when I try it, I just see the output of the diff on the screen, with no changes applied:

testb $> ls
file.txt

testb $> patch -i - | diff -Nub . ../testa
diff -Nub ./file.txt ../testa/file.txt
--- ./file.txt  2011-07-12 09:40:08.195467000 -0400
+++ ../testa/file.txt   2011-07-12 09:39:11.181666500 -0400
@@ -1,9 +1,7 @@
 ijaosdfji
 jaiosdfjio
 jklasdkml
-asdkml
-s;lnk
-lsadjkl
-asdfas
-asdf
+klasdkml
+nas;lnk
+jklsadjkl

diff -Nub ./file2.txt ../testa/file2.txt
--- ./file2.txt 1969-12-31 19:00:00.000000000 -0500
+++ ../testa/file2.txt  2011-07-12 09:39:44.196235000 -0400
@@ -0,0 +1,6 @@
+aljksdf
+jklasdflkjlknm
+nksalk;
+klaskl;
+ioasjdoiaj
+lkmasd'lkm

testb $> ls
file.txt

2 Answers 2

13

Don't you want the other way around?

diff -Nub . /current-files | patch -b
1
  • 1
    Yes, I think I do :)
    – user394
    Jul 12, 2011 at 13:55
0
patch -p1 << EOF
diff --git a/debian.master/config/config.common.ubuntu b/debian.master/config/config.common.ubuntu
index 5ff32cb997e9..8a190d3a0299 100644
--- a/debian.master/config/config.common.ubuntu
+++ b/debian.master/config/config.common.ubuntu
@@ -10153,7 +10153,7 @@ CONFIG_VIDEO_ZORAN_ZR36060=m
 CONFIG_VIPERBOARD_ADC=m
 CONFIG_VIRTIO=y
 CONFIG_VIRTIO_BALLOON=y
-CONFIG_VIRTIO_BLK=m
+CONFIG_VIRTIO_BLK=y
 CONFIG_VIRTIO_BLK_SCSI=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_VIRTIO_INPUT=m
EOF

Example from: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .