Bob Proulx wrote:
Uhm, well, hmm... Once you start worring about whitespace in
filenames handling spaces but not handling newlines just doesn't feel
right. Yes that will handle spaces but then not files with newlines
in them. If effort is going to be put in there to handle one then the
other is not too far away using zero terminated strings.
Except... how many people have file names with '\n' in them? How many
have files with ' ' in them? :-)
Given that most any GUI makes it easy to put ' ' in a file name (even
without thinking about what problems it might cause), such files are
fairly popular. Also it is natural to name a file e.g. 'My Christmas
List.odt'. Not so much to put '\n' in a file name. (And, come to think
of it, I bet most GUI's would have problems coping with file names
containing '\n's.)
I understand the ivory tower approach, but really, what percentage of
users have files with ' ' in their names, and how does it compare to the
percentage of users with file names containing '\n'? I bet the former is
pretty close to 100%, and the latter pretty close to 0.
Practically speaking, using 'xargs -d \\n' will work 99.9999% of the time.
--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job. -- The Hitchhiker's Guide to the
Galaxy (Douglas Adams)