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 15:14:16 +0200 Message-Id: <1478765723@web.de> MIME-Version: 1.0 From: Andreas Eibach To: cygwin AT cygwin DOT com Subject: LS and spaces in path names (the xth) Content-Type: text/plain; charset=iso-8859-1 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j5SDFCRh016738 Yes, this is the umpteenth time this gets asked, but also the umpteenth plead to fix this in cygwin (as it _definitely_ works in Linux, also with vfat and non-Linux partitions!!) I have two files in ~, say they're CD0.dat CD1 - Multimedia (foo1).dat CD2 - Multimedia2 (foo2).dat +++++++++++++++++++++++++++++++++++++++++ Precondition: Imagine that the 'TAB' key doesn't function. +++++++++++++++++++++++++++++++++++++++++ (since if I want to write a script, it should be _portable_; and if it can be only be made work _with_ TAB, it is a kludge and should be fixed properly. Period.) ls -hog CD* [NB: ls -hog is smarter, because shorter in output; for this "exercise" we'll need neither group nor owner] works and shows the three files: -rw-r--r-- 1 0 Jun 28 14:46 CD0.dat -rw-r--r-- 1 24K Jun 28 14:46 CD 1 - Multimedia.dat -rw-r--r-- 1 2.9K Jun 28 14:46 CD 2 - Multimedia.dat So far, so good. But all attempts show files with -CD- -SPACE- -NUMBER 1 or 2- failed: ls -hog "CD *" ls: CD *: No such file or directory also ls -hog "CD [12]*" ls: CD [12]*: No such file or directory fails. But ls -hog "CD*[12]*" WORKS. But why? After the 'CD', what character is this in Cygwin? It seems, it's not a valid character at all! At least it does not seem to be a "real" space, since I've tried using option -b in LS and got nothing but also this '\ ' crap. But as soon as the next file entry began, I got a correct '\n'. I have tried to replace the character between CD and the [12] by various characters (tab and so on), but could never get a match. I've also tried ' ' ticks, but without success. Needless to say that scripts containing for i in `ls *.dat*`; do .... will NOT work, because Cygwin will interpret each sub-string between the \ ' s separately, making parsing files a nuisance. I scanned the archives and found something about using xargs. I've never used this command (except for finding strings); but if Cygwin is called a "win32 unix layer" shouldn't it behave like Unix and at least WORK with the above line? You can't deny at least one of these shown DO work in Unix and Linux. Without kludges, that is. So I'd say this is an issue and should at least be tackled. -Andreas _________________________________________________________________________ Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179 -- 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/