Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 28 Jun 2005 09:09:04 -0700 (PDT) From: Kaz Kylheku To: Andreas Eibach cc: cygwin AT cygwin DOT com Subject: Re: LS and spaces in path names (the xth) In-Reply-To: <1478765723@web.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 28 Jun 2005, Andreas Eibach wrote: > Needless to say that scripts containing > > for i in `ls *.dat*`; do .... Ouch!!! > will NOT work, because Cygwin will interpret each sub-string between the \ ' s separately, making parsing files a nuisance. That script won't work anywhere. Who ever writes braindamaged shell code like that? It takes the output of a command and re-tokenizes it, so that files with spaces will turn into multiple tokens. You want: for i in *.dat* ; do some-command "$i" ; done The quotes around $i are important too. Or, to be properly paranoid, you have to watch for "$i" expanding into something that looks like a command option to some-command. If some-command is properly designed, it takes the -- option to indicate ``no more options'': for i in *.dat* ; do some-command -- "$i" ; done -- Meta-CVS: the working replacement for CVS that has been stable since 2002. It versions the directory structure, symbolic links and execute permissions. It figures out renaming on import. Plus it babysits the kids and does light housekeeping! http://freshmeat.net/projects/mcvs -- 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/