Re: Filenames containing newlines



In article <1zXVf.43034$wl.5000@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
DaveG <dave-ng@xxxxxxxx> wrote:
I often see it mentioned in here about how one must take care to allow for
"unusual" filenames when writing shell scripts to handle multiple files.

In particular, the example most often raised is a warning to watch out for
filenames with the newline character in the name.

My question, sort of a mini survey if you like, is just how many people
use newlines in filenames or how often do you come across filenames with
newlines in them?

Newlines in filenames are mainly something you would encounter in a malicious
context - created by a local user, included in an archive, etc. Since I don't
expect to ever see a *useful* file with a newline embedded in its name, and
using newline-terminated filenames is often more convenient than using
null-terminated filenames, some of the utilities I write simply ignore them,
e.g.:

find ... ! -name '*
*' ...

John
--
John DuBois spcecdt@xxxxxxxxxx KC6QKZ/AE http://www.armory.com/~spcecdt/
.