Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!seismo!gatech!akgua!whuxlm!whuxl!houxm!ihnp4!ihuxp!bamford From: bamford@ihuxp.UUCP (Bamford) Newsgroups: net.micro.att Subject: Re: UNIX PC command surprises... Message-ID: <1247@ihuxp.UUCP> Date: Mon, 24-Mar-86 17:55:32 EST Article-I.D.: ihuxp.1247 Posted: Mon Mar 24 17:55:32 1986 Date-Received: Mon, 21-Apr-86 01:19:50 EST References: <351@hropus.UUCP> <888@kitty.UUCP> Organization: AT&T Bell Laboratories Lines: 29 > In article <351@hropus.UUCP>, jrw@hropus.UUCP (Jim Webb) writes: > > Has anyone else out there noticed that on the "7300" the > > grep, egrep, and fgrep commands are IDENTICAL. The other > > day I did an egrep "nproc|NPROC" or some such thing and > > it failed! A quick cmp of grep and egrep yielded no > > differences, in fact, grep and fgrep are linked together. > > Aw, come on! *THINK* I'm suprised that you haven't discovered that > ``edit'', ``ex'', and ``vi'' are also identical and are linked together. Does > that mean they are the same? > In case you still don't know the answer... In an program, argv[0] is > the NAME by which the program was invoked. Since the source code for grep & > egrep is very similar, the same compiled program is used, with the argv[0] > being used to switch the internal program logic. The same situation is also > used for the above editors. It is true, and it is reasonable, that some programs modify their behavior according to the name by which they are called. However, the original comment above was to the effect that "egrep" was not behaving as advertised, and it appears to be because it is the same as "grep". egrep, grep, and fgrep use radically different methods and do not normally share source, so seeing them linked together IS a surprise. -- Harold Bamford AT&T Bell Labs (cornet) 8-367-5744 Naperville, Ill (312) 979-5744