On Jul 30, 2005, at 7:29 AM, Jean-François Mertens wrote:
PatchScript: <<
#!/bin/sh -ev
sed -i '/regex/i\
\tbar1\
\tbar2' foo/Makefile.in
<<

or for a multiline substitution, I see that with /usr/bin/sed
one can't use \n, but has to put the newline explicitly, preceded
by a backslash.

Similar pitfalls can occur in other fields: maybe every heredoc
starting with "#!" should be exempted...

The new algorithm doesn't remove all leading whitespace. It removes from each line a *maximum* of whitespace characters as are on the first line of that block. So if I do:

Info2: <<
  PatchScript: <<
    #!/bin/sh
    echo <<END > somefile
    foo
        bar
iggy
      blah
    END
  <<
<<

Then afterwards somefile contains:

foo
    bar
iggy
  blah

So it's perfectly possible to continue to include whitespace in a heredoc if that's needed, in fact that's the whole point of the new algorithm.

I hope I'm not missing your point, it can be hard to talk about whitespace because you can't see it :-)

Dave

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to