Re: Pls help with Unix shell question

From: Michael Heiming (michael+USENET_at_www.heiming.de)
Date: 03/05/04


Date: Fri, 5 Mar 2004 18:56:08 +0100


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris F.A. Johnson <c.fa.johnson@rogers.com> wrote:
> On Fri, 05 Mar 2004 at 15:49 GMT, Michael Heiming wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > wl <bli01@yahoo.com> wrote:
> > [..]
> >
> >> I have a bunch of files, ending with ".data" in a Unix directory, which I
> >> want to process in date order with a program. I recall doing
> >> something similar in the old days. Does anyone have an example?
> >
> > for f in `ls -atr *.data`

Hi Chris!

> This breaks is there are spaces in the file names. Use:

> ls -atr *.data | while IFS= read -r f

> Of course, this will not work if there are newlines in any of the
> file names. But I would consider that a broken file system.

Yep, albeit I'd call using spaces in filenames broken, sure most
*nix FS will handle it just fine, albeit it requires lots of
quoting in scripts and isn't IMHO worth the trouble.

- --
Michael Heiming (GPG-Key ID: 0xEDD27B94)

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of spam.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFASL82AkPEju3Se5QRAil/AKCxrrfd1F0GUGZbXE3W2UrBXdpJ4ACgxpAM
lQqRoTqDCPAsWVsu10o4OjM=
=xPR1
-----END PGP SIGNATURE-----



Relevant Pages

  • Re: Pls help with Unix shell question
    ... Chris F.A. Johnson wrote: ... But I would consider that a broken file system. ... Yep, albeit I'd call using spaces in filenames broken, sure most ...
    (comp.unix.misc)
  • Re: Pls help with Unix shell question
    ... Chris F.A. Johnson wrote: ... But I would consider that a broken file system. ... Yep, albeit I'd call using spaces in filenames broken, sure most ...
    (comp.unix.shell)
  • Re: Need pic of BBB Girl in tube from side cabinet
    ... 3:28 and 5:34 in Chris Bucci's video review have decent (albeit not ... full length) pictures. ... and I'm guessing if you ask Chris ...
    (rec.games.pinball)