[Top][All Lists]

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

Re: config.status - robust sed substitutions

From: Paul Eggert
Subject: Re: config.status - robust sed substitutions
Date: 26 Feb 2003 14:52:15 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3

"Robert Anderson" <address@hidden> writes:

> substvar=$( echo @var@ | sed -e "s,@var@,`_quote_for_sed $var`," )

Unfortunately this won't work for implementations of 'echo' that treat
backslash specially.  POSIX 1003.1-2001 requires such behavior, and it
is common.  I've heard that this requirement will be changed soon, but
nevertheless we need to port to hosts that implement it.

Also, it won't work if @var@ is -n, on implementations where "echo -n"
echoes without a trailing newline.

One workaround is to use printf if available, and fall back on echo if
printf is not available.  Another possibility is to use expr, though
this will require a loop.

But these will be portability hassles in their own right.  Perhaps
it'd be simpler just to pick some other delimiter like '|' and live
with its limitations.

reply via email to

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