delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/30/17:11:45

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4A9AEB04.1090603@bopp.net>
Date: Sun, 30 Aug 2009 16:11:32 -0500
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: pipelines with paths containing spaces
References: <C805838568BA4CBA81CA871CDED956D7 AT p43400e>
In-Reply-To: <C805838568BA4CBA81CA871CDED956D7@p43400e>
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

David Christensen wrote:
> I am having trouble using pipelines with paths containing spaces:

This is not technically a Cygwin-specific issue, so I'm going to try to
keep this short.

>     2009-08-31 01:16:50 Administrator AT p43400e ~
>     $ ls -d /cygdrive/c/Documents\ and\ Settings/ | xargs ls
>     ls: cannot access /cygdrive/c/Documents: No such file or directory
>     ls: cannot access and: No such file or directory
>     ls: cannot access Settings/: No such file or directory

Please refer to the manpage for xargs by running the following:

man xargs

That should explain why the path is being split.

>     2009-08-31 01:16:55 Administrator AT p43400e ~
>     $ ls `ls -d /cygdrive/c/Documents\ and\ Settings/`
>     ls: cannot access /cygdrive/c/Documents: No such file or directory
>     ls: cannot access and: No such file or directory
>     ls: cannot access Settings/: No such file or directory

This happens because of the way Bash, the shell you're running, splits
things into words.  See the manpage for bash:

man bash

Look for the IFS variable's description in the Shell Variables section.
 The following section of the Bash manual is also good:

http://www.gnu.org/software/bash/manual/html_node/Word-Splitting.html#Word-Splitting

-Jeremy

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

- Raw text -


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