Date: Wed, 2 Feb 2005 00:04:15 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 519 ************************************************** Tuesday 01 February 2005 Number 519 ************************************************** Subjects for today 1 Re: Patching from a 'here document' : John Poltorak 2 Re: Patching from a 'here document' : Illya Vaes 3 Re: Patching from a 'here document' : Thomas Dickey **= Email 1 ==========================** Date: Tue, 1 Feb 2005 12:06:13 +0000 From: John Poltorak Subject: Re: Patching from a 'here document' On Thu, Jan 27, 2005 at 03:19:02PM -0800, Steven Levine wrote: > In <20050126091655.A47 at warpix.org>, on 01/26/05 > at 09:16 AM, John Poltorak said: > > >I assume it is possible to apply a patch from a 'here document' ie > >inline from a shell script, but I can't figure out how. Does anyone else > >know? > > Have you tried: > > patch args < patch goes here > EOF I couldn't figure out the syntax originally but what you suggest works OK. The problem is that with an inline patch in a shell script the '$' symbol appears to be interpreted differently, ie as variable identifier. How do I escape the character so that it is interpreted literally? Could any other characters also foul things up? > The default is read patches from stdin. > > Steven > > > -- > ---------------------------------------------------------------------- > "Steven Levine" MR2/ICE 2.67 #10183 Warp4.something/14.100c_W4 > www.scoug.com irc.fyrelizard.com #scoug (Wed 7pm PST) > ---------------------------------------------------------------------- > -- John **= Email 2 ==========================** Date: Tue, 1 Feb 2005 12:30:46 GMT From: Illya Vaes Subject: Re: Patching from a 'here document' >>Have you tried: >> >> patch args <> patch goes here >> EOF > >I couldn't figure out the syntax originally but what you suggest works OK. >The problem is that with an inline patch in a shell script the '$' symbol >appears to be interpreted differently, ie as variable identifier. That's the way it's supposed to work, since the part between "<How do I escape the character so that it is interpreted literally? The backslash ('\') is the standard Unix escape character. How could you do UnixOS2 without knowing *that*!?! ;-) Use "\\" is you want a literal '\'. >Could any other characters also foul things up? Depends on the called program, doesn't it? Here-documents for perl look different from those for awk from those for patch. **= Email 3 ==========================** Date: Tue, 1 Feb 2005 07:53:31 -0500 (EST) From: Thomas Dickey Subject: Re: Patching from a 'here document' On Tue, 1 Feb 2005, John Poltorak wrote: > On Thu, Jan 27, 2005 at 03:19:02PM -0800, Steven Levine wrote: >> Have you tried: >> >> patch args <> patch goes here >> EOF > The problem is that with an inline patch in a shell script the '$' symbol > appears to be interpreted differently, ie as variable identifier. > > How do I escape the character so that it is interpreted literally? You add a quote (several choices) to the "EOF" in the first line, e.g. patch args << 'EOF' -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net