On Fri, Feb 05, 1999 at 08:22:46PM -0600, dan wrote: > I was looking through the contents of /bin when I noticed that the files grep, > egrep, and fgrep, were all identical. Further investigation shows that they > determine how to act by analyzing their command line. > > Here is how to reproduce what I found: > > $ cd /bin; ls -l *grep > -rwxr-xr-x 3 root root 75728 Apr 27 1998 egrep > -rwxr-xr-x 3 root root 75728 Apr 27 1998 fgrep > -rwxr-xr-x 3 root root 75728 Apr 27 1998 grep > $ diff grep egrep > $ diff grep fgrep Note the "3" in those ls'es -- that means the binary "grep" has three different names. If you try ls -i *grep to get the inode numbers, you'll notice that they're all the same: 190 -rwxr-xr-x 3 root root 75728 Apr 27 1998 /bin/egrep* 190 -rwxr-xr-x 3 root root 75728 Apr 27 1998 /bin/fgrep* 190 -rwxr-xr-x 3 root root 75728 Apr 27 1998 /bin/grep* So they're hardlinks, so there's no extra space being used. Cheers, aj -- Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/> I don't speak for anyone save myself. PGP encrypted mail preferred. ``Like the ski resort of girls looking for husbands and husbands looking for girls, the situation is not as symmetrical as it might seem.''
Attachment:
pgpa4Aej9rHRS.pgp
Description: PGP signature