Dot files always first in directory?

Blair P. Houghton bph at buengc.BU.EDU
Fri May 5 20:13:37 AEST 1989


In article <3540 at udccvax1.acs.udel.EDU> conan at vax1.acs.udel.EDU (Robert B Carroll) writes:
>In article <11108 at bloom-beacon.MIT.EDU> jik at athena.mit.edu (Jonathan I. Kamens) writes:
>>It it safe to assume when writing a program which manipulates
>>directories that . and .. will always be the first two entries in a
>>directory?
>
>NO, its not save to assume that.
>try "touch #abcd" then 'list' the directory.

To beat this horse quite dead, any leading character that would sort before
the period will place the filename before the . and .. in a directory
listing.  The ascii characters that will do this are space, !, ", #, $, %,
&, ', (, ), *, +, ,, and -.  I haven't tried it, but I bet you can get the
nonprinting ascii characters to do it too.  There are 32 of those.

I've actually had the fun ( yeah, right %-) ) task of trying to remove a
file called * from a directory.  It's easy, _once_you_know_how_...

				--Blair
				  "...and now, with this set of
				   Time/Life books..."



More information about the Comp.unix.wizards mailing list