Earlier quoted context omitted.
Different behavior based on argv[0] was first brought to my attention when I discovered that /bin/sh was a symlink on some Linux systems. Bash has a Bourne shell compatibility mode.
Bash actually has a POSIX compatibility mode. There is a great deal in POSIX that was not in Bourne, native arithmetic expressions being the first to come to mind, then new-style command substitution. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V... All of the POSIX utility standards, including the grep variants, can be found in the URL's parent directory: https://pubs.opengroup.org/onlinepubs/96999197…
The OpenBSD package is superior.
The GNU gzip package includes a zgrep shell script that is adapted from work by "Charles Levert " - this is similarly adapted for bzgrep and xzgrep.
The OpenBSD implementation will have superior performance for zgrep, because it is native C.
rebel$ ls -li /usr/bin/*grep
466612 -r-xr-xr-x 6 root bin 31520 Apr 11 2022 /usr/bin/egrep
466612 -r-xr-xr-x 6 root bin 31520 Apr 11 2022 /usr/bin/fgrep
466612 -r-xr-xr-x 6 root bin 31520 Apr 11 2022 /usr/bin/grep
466711 -r-xr-xr-x 2 root bin 15288 Apr 11 2022 /usr/bin/pgrep
466612 -r-xr-xr-x 6 root bin 31520 Apr 11 2022 /usr/bin/zegrep
466612 -r-xr-xr-x 6 root bin 31520 Apr 11 2022 /usr/bin/zfgrep
466612 -r-xr-xr-x 6 root bin 31520 Apr 11 2022 /usr/bin/zgrep