"Robert Anderson" <[EMAIL PROTECTED]> writes:

|> I submit for your critique an idea for making the generated sed
|> commands within config.status be robust to "special" characters
|> such as the delimiter  - which happens to have been chosen as ","
|> - as well as sed metacharacters '&' and '\'.
|> 
|> This would be implemented as a small standalone script generated
|> by config.status in /tmp, but the following gives the idea concisely:
|> 
|> #!/bin/ash
|> 
|> _quote_for_sed()
|> {
|>     echo "$1"| \

Look out for echo meta character.

|>      sed -e 's,\\,\\\\,g' | \
|>      sed -e 's,&,\\&,g' | \
|>      sed -e 's,\,,\\\,,g'
|> }

        sed -e 's/[\&,]/\\&/g'

is much faster and works as well.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 N�rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Reply via email to