9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.63k stars 321 forks source link

use grep -E instead of egrep #622

Open lufia opened 1 year ago

lufia commented 1 year ago

I noticed egrep always output warning:

egrep: warning: egrep is obsolescent; using grep -E

I heared this warning may be introduced in GNU Grep v3.8.

dancrossnyc commented 1 year ago

Not all systems use GNU grep, however, and the world as a whole does not seem to be in a rush to get rid of egrep. I find the warnings annoying; some uses of egrep can probably just be replaced with grep (without the -E) which would, at least, cut down on the noise.

On the other hand, grep -E does seem to be in POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) so it may be sufficiently portable, and POSIX does make a note about the intention to combine grep, egrep and fgrep into a single command. However, I am not sure that everything that plan9port supports has gotten the memo yet.

lufia commented 1 year ago

According to https://9fans.github.io/plan9port/

Linux (x86, x86-64, PowerPC, and ARM), FreeBSD (x86, x86-64), Mac OS X (x86, x86-64, and Power PC), NetBSD (x86 and PowerPC), OpenBSD (x86 and PowerPC), SunOS (x86-64 and Sparc), Dragonfly BSD (x86-64).

I checked grep supports -E option nowadays on several systems:

The -E option means to allow extended regexp in all implementations of grep(1).

macie commented 7 months ago

This PR fixes #587