Re:A prog by any other name
by rraval on Thursday April 28, 2016 @03:49PM
(#11591464)
That may just be because they are shell scripts instead of symlinks. On ArchLinux:
The general point of them being implemented by the same executable still stands.
[ Parent
| on HN ]
No, on my system they're three distinct executables; check the sizes shown in my previous comment.
Ubuntu 14.04 uses GNU grep 2.16. When I install it from source (grep-2.16.tar.xz), I get the three distinct executables. When I install the latest version (2.25) from source, egrep and fgrep are shell script that invoke "grep". (Which could be a problem if you happen to have another "grep" command in an earlier directory in your $PATH. Symlinks would avoid that problem.)
Here's the Changelog entry for the change to shell scripts:
2014-03-23 Paul Eggert <[email protected]>
egrep, fgrep: go back to shell scripts
Although egrep's and fgrep's switch from shell scripts to
executables may have made sense in 2005, it complicated
maintenance and recently has caused subtle performance bugs.
Go back to the old way of doing things, as it's simpler and more
easily separated from the mainstream implementation. This should
be good enough nowadays, as POSIX has withdrawn egrep/fgrep and
portable applications should be using -E/-F anyway.Just as another data point, on my system (fully up to date arch) it's half and half:
$ file -i /usr/bin/*grep|sort -k2,2 [17:59:42]
/usr/bin/grep: application/x-executable; charset=binary
/usr/bin/igrep: application/x-executable; charset=binary
/usr/bin/pgrep: application/x-executable; charset=binary
/usr/bin/msggrep: application/x-executable; charset=binary
/usr/bin/deepgrep: application/x-executable; charset=binary
/usr/bin/pcregrep: application/x-executable; charset=binary
/usr/bin/lzgrep: inode/symlink; charset=binary
/usr/bin/lzegrep: inode/symlink; charset=binary
/usr/bin/lzfgrep: inode/symlink; charset=binary
/usr/bin/xzegrep: inode/symlink; charset=binary
/usr/bin/xzfgrep: inode/symlink; charset=binary
/usr/bin/egrep: text/x-shellscript; charset=us-ascii
/usr/bin/fgrep: text/x-shellscript; charset=us-ascii
/usr/bin/zgrep: text/x-shellscript; charset=us-ascii
/usr/bin/bzgrep: text/x-shellscript; charset=us-ascii
/usr/bin/xzgrep: text/x-shellscript; charset=us-ascii
/usr/bin/zegrep: text/x-shellscript; charset=us-ascii
/usr/bin/zfgrep: text/x-shellscript; charset=us-ascii
/usr/bin/zipgrep: text/x-shellscript; charset=us-ascii