[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
- Re: config.status - robust sed substitutions, (continued)
Re: config.status - robust sed substitutions, Paul Eggert, 2003/02/26
- Re: config.status - robust sed substitutions, Robert Anderson, 2003/02/26
- Re: config.status - robust sed substitutions, Paul Eggert, 2003/02/26
- Re: config.status - robust sed substitutions, Robert Anderson, 2003/02/26
- Re: config.status - robust sed substitutions, Robert Anderson, 2003/02/26
- Re: config.status - robust sed substitutions, Paul Eggert, 2003/02/27
- Re: config.status - robust sed substitutions, Robert Anderson, 2003/02/27
- Re: config.status - robust sed substitutions, Andreas Buening, 2003/02/28
Re: config.status - robust sed substitutions,
Robert Anderson <=