[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed --posix does not catch incomplete arguments
From: |
Eric Blake |
Subject: |
Re: sed --posix does not catch incomplete arguments |
Date: |
Fri, 18 Jun 2010 09:26:43 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4 |
On 06/18/2010 05:27 AM, Bruno Haible wrote:
> Hi Eric,
>
>> About the only portable alternative that I could think of for a makefile
>> would be to use multiple echo (or printf) into a temporary file, then
>> use sed -f file, rather than relying on multiple -e.
>
> The makefile can also construct a newline as contents of a shell variable.
> In Makefile syntax:
>
> stmt=`echo "nl='"; echo "'"`; eval "$$stmt"; : | sed -e "1{$${nl}}"
Clever trick! I was giving up on `` as a way to generate newline,
because it consumes newlines, but your use of quoting characters and
eval solves that.
Is this trick worth documenting in the portable Makefile section of
autoconf?
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: sed --posix does not catch incomplete arguments,
Eric Blake <=