This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: pipelines with paths containing spaces
- From: Jeremy Bopp <jeremy at bopp dot net>
- To: cygwin at cygwin dot com
- Date: Sun, 30 Aug 2009 16:11:32 -0500
- Subject: Re: pipelines with paths containing spaces
- References: <C805838568BA4CBA81CA871CDED956D7@p43400e>
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@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@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