From: Michael McDaniel Date: 2002-04-07T05:16:14+09:00 Subject: Re: a note on the . and .. discussion Marko Schulz wrote: > I've got a notion that there is a wide consensus on this issue: > - It would be very good to have methods on Dir which ignore '.' and > '..', but they should be new methods. > - That way no old script will be broken and if one really wants to see > '.' and '..' he will still get them. > - Soon everybody will use just the new methods. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I would vote to add new default argument to existing method. Default argument would be set to show '.' and '..', and would break no existing code. In future code you could just add the new argument and change the default value to not show '.' and '..' if you chose. You could use a parameter so that if you changed your mind later, you could change the parameter in one place rather than having to go through and change method names in (possibly) multiple locations in code. Also, 'ls -ia' will show you the inodes of all the file entries. In root, '.' and '..' have same inode (mkfs initializes filesystem in this manner). In some UNIX (though not w/my Linux box) you can do a 'cat .' and see directory contents. The data is stored in directory using inode structure just like for 'regular' files. I presume GNU 'cat' behaviour is strictly an implementation decision not to list directory contents, but it may be Linux specific. ~mm