[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: du and wc should be able to read arguments from a file
From: |
Bernd Jendrissek |
Subject: |
Re: du and wc should be able to read arguments from a file |
Date: |
Fri, 19 Sep 2003 17:34:33 +0200 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Sep 19, 2003 at 09:12:05AM -0600, Bob Proulx wrote:
> Bernd Jendrissek wrote:
> > Jim Meyering wrote:
> > > If the format is simply one file name per line, then what about
> > > files with names containing a newline?
> > >
> > > One solution is to require that newlines and backslashes be
> > > backslash-escaped. Another is simply to require that file names
> > > be NUL (aka '\0') separated, like what find's -print0 option would
> > > output. In the interests of keeping things simple, I'm leaning
> > > toward the latter.
> >
> > And even if the list of filenames is \n-separated to begin with, you can
> > always pipe that through tr '\n' '\0'.
>
> Actually, no. If the filename contained a newline then converting
> that newline to a null would no longer match the original filename.
Yes, and such filenames wouldn't be understood anyway, even if the next
program in the pipeline (ls, wc, du) assumed \n-separated lines. All
I'm saying is that if you have to choose, choose \0. Otherwise, you'd
have completely non-doable commands (besides invoking GCC).
Let's say you have a bunch of files, some of which contain \n in their
names. So you use find to generate a list. How do you deal with those
problem files? You can use -print0, but then if wc wants \n-separated
lines, you'd try to use tr and find that it just ambiguates the
different kinds of \n - charset for filenames and filename separators.
Luckily, none of du, ls or wc use -0, so these tools could just adopt
xargs's way of doing it: user chooses with -0 or not- -0.
Personally, I don't like the idea of wanting backslash-escaped filenames
on bit.
- --
[I can't guarantee the integrity of my mail; I suspect my employer of
mail tampering (adding disclaimers without my authorization). Please
consider only signed text as my words. Verify if you can!]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE/ayHN/FmLrNfLpjMRAuZRAJ0dn+l+t7FNmWAP1AU+4QcNGd6N+QCfRw0U
WStR6DmVSlbzJE1Sq9iFEwM=
=/kMP
-----END PGP SIGNATURE-----
- Re: ls options: accept stdin, and list files except for..., (continued)
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/15
- Re: ls options: accept stdin, and list files except for..., Richard Dawe, 2003/09/15
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/16
- Re: ls options: accept stdin, and list files except for..., Richard Dawe, 2003/09/16
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/16
- Re: ls options: accept stdin, and list files except for..., Richard Dawe, 2003/09/17
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/17
- du and wc should be able to read arguments from a file, Jim Meyering, 2003/09/18
- Re: du and wc should be able to read arguments from a file, Bernd Jendrissek, 2003/09/18
- Re: du and wc should be able to read arguments from a file, Bob Proulx, 2003/09/19
- Re: du and wc should be able to read arguments from a file,
Bernd Jendrissek <=
- Re: du and wc should be able to read arguments from a file, Dave Gotwisner, 2003/09/19
- Re: du and wc should be able to read arguments from a file, Richard Dawe, 2003/09/19
- Re: du and wc should be able to read arguments from a file, Dave Gotwisner, 2003/09/20
- Re: du and wc should be able to read arguments from a file, Jim Meyering, 2003/09/20
- Re: ls options: accept stdin, and list files except for..., Dave Gotwisner, 2003/09/15