Hello,
I have been trying to use Patch 2.6.1 on Grml 3.7.9 in order to patch a
Xserver configuration file.
I would like to do it in a shell script:
#!/bin/sh
#grml-patch-xserverrc
patch -p0 <<EOF
--- /etc/X11/xinit/xserverrc 2012-06-16 23:54:02.000000000 +0200
+++ /etc/X11/xinit/xserverrc 2013-03-14 09:53:27.581543109 +0100
@@ -1,3 +1,4 @@
#!/bin/sh
-exec /usr/bin/X -nolisten tcp "$@"
+#notcp="-nolisten tcp"
+exec /usr/bin/X $notcp "$@"
EOF
Unfortunatelly, I keep getting an error message:
patching file /etc/X11/xinit/xserverrc
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file
/etc/X11/xinit/xserverrc.rej
I have tried to extract the diff part from my script, write it to a file
(f.e. patch.diff) and include it into execution:
$ sudo patch -p0 < patch.diff
And this way works properly, but I would like to have a shell script to
do it for me.
I have tried various combinations (f.e. with bash or zsh) or with
different separators (instead of EOF), but none of them were succesful
in the end. I could not find any information about this issue anywhere.
Did I commit a mistake while using here document with Patch in a shell
script?
Kind regards,
Mateusz Cieciura