NetBSD-Bugs archive

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

Re: bin/39002: harmful AWK extension: non-portable escaped character

On Fri, Jun 20, 2008 at 09:35:01PM +0000, Greg A. Woods; Planix, Inc. wrote:
 >  Gawk is sometimes a noisy pain in the butt.  :-)
 >  It is long standing tradition in Unix tools and languages to ignore  
 >  the backslash on non-special characters, right from C on up.

Ordinarily, I'd agree, but in this case I think it's right to warn
about it.

In awk one often stuffs regexps into string constants, and it's easy
to forget that if you're trying to escape something *in the regexp*
you need to write two backslashes. Then one ends up with expressions
like (foo ~ "\.c$") that superficially look ok but silently do the
wrong thing. This is doubtless why mawk behaves the way it's reported
to, but I don't think adopting that behavior is a good idea.

David A. Holland

Home | Main Index | Thread Index | Old Index