GNU grep's new features (Linux.com)
GNU grep's new features (Linux.com)
Posted Jun 2, 2006 12:00 UTC (Fri) by jond (subscriber, #37669)In reply to: GNU grep's new features (Linux.com) by nix
Parent article: GNU grep's new features (Linux.com)
egrep and fgrep are just shell scripts that call grep -E and grep -F on my system (sarge). I found this out the hard way, when I was using fgrep in a busy loop.
Posted Jun 2, 2006 16:14 UTC (Fri)
by nix (subscriber, #2304)
[Link] (4 responses)
Posted Jun 4, 2006 2:21 UTC (Sun)
by vonbrand (subscriber, #4458)
[Link] (3 responses)
Yet another reason to consider the coding standard to be braindamaged.
Posted Jun 5, 2006 9:56 UTC (Mon)
by nix (subscriber, #2304)
[Link] (2 responses)
POSIX agreed: hence grep -E and grep -F, and the deprecation of look-at-argv[0] programs.
Posted Jun 8, 2006 7:41 UTC (Thu)
by lysse (guest, #3190)
[Link] (1 responses)
Posted Jun 8, 2006 12:34 UTC (Thu)
by nix (subscriber, #2304)
[Link]
busybox is also a bit of a special case, in that 'size is everything', so the heaps-of-symlinks approach actually makes sense.
(But you don't necessarily need any of the symlinks. If you're running everything from a busybox shell, you can tell it to find busybox commands first regardless of the absence of symlinks.)
The BSDs have a tool called crunchgen which smashes a bunch of programs into one which conditionalizes off argv[0] in much the same way. (Except that busybox is smaller and doesn't penalize the rest of the system by forcing the *default* tools to be little featureless ones.)
This is true in the upstream distro, and has been true since at least 2002. (Before that they were three separate binaries with different behaviours; having a single program that acts differently depending on its name is a violation of the GNU Coding Standards, so it wasn't implemented like that except for a brief period in 2002.)GNU grep's new features (Linux.com)
GNU grep's new features (Linux.com)
...having a single program that acts differently depending on its name is a violation of the GNU Coding Standards, ...
The reasoning is entirely sensible: it is counterintuitive to have a program act differently simply because you mv'ed it to a different name. Among other things, having grep behave differently simply because you called it egrep *bans* you from making egrep a wrapper script, unless there is some other way to get at egrep's behaviour.GNU grep's new features (Linux.com)
Where does that leave BusyBox?GNU grep's new features (Linux.com)
busybox isn't specified by POSIX nor is it a GNU project (nor does it even slightly conform to the GNU Coding Standards).GNU grep's new features (Linux.com)