delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/07/21/18:10:23

X-Spam-Check-By: sourceware.org
Message-ID: <46A28476.9010706@byu.net>
Date: Sat, 21 Jul 2007 16:11:02 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.5) Gecko/20070716 Thunderbird/2.0.0.5 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, lefevrol AT yahoo DOT com
Subject: Re: ls returning file list as one big string
References: <f7ttjj$h7q$1 AT sea DOT gmane DOT org>
In-Reply-To: <f7ttjj$h7q$1@sea.gmane.org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019