Hello, Earnie!

On Tue, 29 Aug 2000, Earnie Boyd wrote:

> But is egrep portable?  Is the grep in question here GNU grep?  AFAIK '^ *+' is
> a regular expression and not an extended regular expression.

egrep is portable. It is used by autoconf several times without checking
its existance.

I tried to find out what's happening. I still don't have the full picture,
but let me tell you what I have found so far.

grep-2.4.2 is sufficient to reproduce the problem. No need to upgrade libc
- glibc-2.1.1 is fine.

$ grep --version
grep (GNU grep) 2.4.2
[Copyright etc skipped]
$ echo foo >infile
$ grep -v '^ *+' infile
foo
$ grep -vE '^ *+' infile
$

Now the questions.

1) What '^ *+' is supposed to filter out?

2) Can it be rewritten is a more portable form?

3) How portable is it to assign the result to a variable? Some shells
may have size limitations. Maybe the return code of grep is better? If
the result of "grep -v" is not defined (I don't want to risk) the last
grep could be without "-v"

There is an interesting comment before the definition of AC_TRY_CPP in
acgeneral.m4:

# Capture the stderr of cpp.  eval is necessary to expand ac_cpp.  We
# used to copy stderr to stdout and capture it in a variable, but that
# breaks under sh -x, which writes compile commands starting with ` +'
# to stderr in eval and subshells.

This statement seems to contradict to the code. We are still trying to
capture the output in a variable and filter out pluses. But the comment
says that we "used to".

I'm puzzled.

Regards,
Pavel Roskin

Reply via email to