[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed and limited record length
From: |
Gary V. Vaughan |
Subject: |
Re: sed and limited record length |
Date: |
Mon, 22 May 2006 12:07:19 +0100 |
User-agent: |
Thunderbird 1.5.0.2 (Macintosh/20060308) |
Ralf Wildenhues wrote:
Hi Gary,
Hallo Ralf!
* Gary V. Vaughan wrote on Mon, May 22, 2006 at 11:45:01AM CEST:
Ralf Wildenhues wrote:
I intend to find out whether $NL2SP really is sufficient,
or all of those should be
($NL2SP; echo)
instead, to ensure a final newline.
easier to write:
foo=`echo X"$bar " | $SP2NL | $Xsed -e baz | $NL2SP`
Erm, after
echo X"$bar "
the data ends with space-newline, after
D'oh! Guess I need more caffeine :-?
| $SP2NL
that will be newline-newline, after
| $Xsed -e baz
that will still be the case, after
| $NL2SP
it will be space-space. Then, the shell is to rip off the final
newline, if any.
That part was deliberate on my part; I thought you were worried that
for some implementations of $Xsed input that didn't end with a NL
would be problematic...
My point is that some shells may be confused iff
there is no final newline. That's what the ($NL2SP; echo) would be for.
I simply don't know whether that is necessary for some broken shells.
...but you are worried that there are shells that don't like backtick
substitutions that don't end with a newline? I would be amazed if
such a shell could even come close to being able to run a typical
configure script. Or do you mean there are shells where the later
``eval $bar'' will fail without a trailing newline?
Cheers,
Gary.
--
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://blog.azazil.net
GNU Hacker / )= http://trac.azazil.net/projects/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook