autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: config.status - robust sed substitutions


From: Robert Anderson
Subject: Re: config.status - robust sed substitutions
Date: 26 Feb 2003 20:09:58 -0800

On Wed, 2003-02-26 at 15:43, Paul Eggert wrote:
> Robert Anderson <address@hidden> writes:
> 
> > For the line you've left here, I don't see a problem.  @var@ is @var@
> > and can be nothing else; it's not a variable.
> 
> Sorry, I misunderstood the example.
> 
> > _quote_for_sed()
> > {
> >     sed -e 's/[\&,]/\\&/g'<<_ACEOF
> > $1
> > _ACEOF
> > }
> > 
> > I don't think this (^^^) is of sufficient complexity to make it worth
> > living with the uncertainties of choosing another character and hoping
> > it doesn't cause problems.
> 
> It's not a question of complexity; it's a question of reliability and
> portability.  Here-documents are dangerous; we've learned this from
> experience.
> 
> If you don't like '|', how about tab?  It's reasonable to prohibit
> tabs in file names.  We already prohibit newlines, so it's not like
> we're being fully general now anyway.

Your fears are not unfounded.  Consider this:

#!/bin/sh

_func()
{
cat<<EOF
$1
EOF
}

var='blah'
echo "xx`_func $var`xx"
echo xx`_func $var`xx

This produces:
xxblahxx
xxblahxx

on RH Linux, IBM AIX, and Compaq OSF1.  Any takers on what comes out of
SunOS 5.1?

Bob






reply via email to

[Prev in Thread] Current Thread [Next in Thread]