ls returning file list as one big string

Eric Blake ebb9@byu.net
Sat Jul 21 22:10:00 GMT 2007


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

According to Olivier Lefevre on 7/21/2007 3:21 PM:
> As the subject says, ls returns the file list as one big string for some
> directories but not others. One sign of that is that, e.g.,
> 
>     for i in `\ls *.java`; do sed -e $i; done

Why not do something that uses less typing, fewer processes, and is less
likely to overflow max command line lengths, and at the same time is
robust to spaces in the filenames?

for i in *.java; do sed -e "$i"; done

>     for i in `\ls *.java`; do echo \"$i\"; done
> 
> which will return. e.g.,
> 
>     "FirstFile.java
>     SecondFIle.java"

I am unable to reproduce this.  Perhaps you can paste the entire contents
of a directory in question?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGooR284KuGfSFAYARApNrAJ9QmXotREJi0Hr0brwFfQZIq6ma+wCdGBoF
uqgl7eg+jIrXBc8JM/tEszE=
=GJOB
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list