giving mouth-to-mouth to a dead horse (was Re: Dot files always first in directory?)
Randal L. Schwartz @ Stonehenge
merlyn at intelob.intel.com
Sun May 7 09:09:43 AEST 1989
In article <2778 at buengc.BU.EDU>, bph at buengc (Blair P. Houghton) writes:
| >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.
Nope (he says, donning the usual asbestos suit...),
the original requestor was using opendir/readdir. These routines have
*NOTHING* to do with ASCII sorting order, but rather return the order
of files in the underlying directory. The original statement
(paraphrased) was "Can I assume that . and .., having generally been
created first, can be safely skipped while scanning the directory *IN
DIRECTORY ORDER* without possibly fouling up?"
The answer, apparently (according to the half dozen responses arriving
here) is *no*.
Your response is the right answer to the *wrong question* -- the
question you answered was "can I get a filename that sorts before the
'.' and '..' entry if I say 'ls -a'?".
(Maybe if you try adding the filenames... no... nevermind... :-)
P.S. Note the yet-again updated sig. BiiN just killed all contractors
and temps -- stay tuned for the dismantling :-)
--
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095===\
{ on contract to BiiN, Hillsboro, Oregon, USA, until 14 May 1989 }
{ <merlyn at intelob.intel.com> ...!uunet!tektronix!biin!merlyn }
{ or try <merlyn at agora.hf.intel.com> after 15 May 1989 }
\=Cute quote: "Welcome to Oregon... home of the California Raisins!"=/
More information about the Comp.unix.wizards
mailing list