Our great sponsors
-
freebsd-src
The FreeBSD src tree publish-only repository. Experimenting with 'simple' pull requests....
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
> When it comes to avoiding forks, the question is why do egrep, fgrep have to be shell scripts rather than interpret the invocation name (argv[0]) for switching behavior.
I don't know. I'd have taken the argv[0] approach personally. And it's the approach some other grep implementations have taken too (eg https://github.com/freebsd/freebsd-src/blob/main/usr.bin/gre...)
I learned about it from ShellCheck [1] that warns if using egrep instead of `grep -E`. That tool deprogrammed many of my bad habits.
While you haven’t used egrep that much, I used it a whole lot, well over 20 times for the automated test setup I have for my open source project. I had to spend most of an hour this morning updating the code to no longer use egrep, and it was non-trivial to update. Here’s the amount of hassle breaking egrep has given me:
https://github.com/samboy/MaraDNS/commit/afc9d1800f3a641bdf1...
This is just one open source project. I’ve seen fgrep in use for well over 25 years and egrep apparently has been around for a very long time too. Just because it didn’t get enshrined in a Posix document—OK, according to Paul Eggert it was made obsolete by Posix in 1992, but apparently no one got the telegram and it’s been a part of Linux since the beginning and is also a part of busybox—doesn’t mean it’s something which should be removed.
I’m just glad I caught this thread and was able to “update” my code.