delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/10/20/17:36:50

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Date: Sat, 20 Oct 2012 14:36:22 -0700
From: Gary Johnson <garyjohn AT spocom DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: CP and Ln can't parse windows path ending in wildcard
Message-ID: <20121020213622.GA4226@phoenix>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20121020190646 DOT 15980 AT gmx DOT com>
MIME-Version: 1.0
In-Reply-To: <20121020190646.15980@gmx.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 2012-10-20, Lawrence Mayer wrote:
> CP and Ln can't parse windows path ending in wildcard
> 
> e.g.
> 
> ln WINDOWS PATH\* DIRECTORY (3rd form)
> ln -t DIRECTORY WINDOWS PATH\*  (4th form)
> cp -l WINDOWS PATH\* DIRECTORY
> 
> all fail returning error message
> 
> 'cannot stat `WINDOWS PATH\\*': No such file or directory'
> 
> Workaround:
> 
> ln WINDOWS PATH/* DIRECTORY
> ln -t DIRECTORY WINDOWS PATH/*
> cp -l WINDOWS PATH/* DIRECTORY
> 
> all appear to work: note forward rather than backward slashes just
> before wildcard.
> 
> 
> I am running cygwin 1.7.17-1 and coreutils 8.15-1, calling above
> commands from cmd.exe 5.2.3790.3959 on Windows Server 2003 sp2
> x32.

In Unix, applications generally don't parse paths, the shell does.
The shell then passes the expanded paths to the applications.

In most if not all Unix shells including bash, a backslash quotes or
removes special meaning from the following character.  If you type
PATH\* as a command argument at the bash prompt, the shell will see
that as PATH followed by a literal * and will pass the string PATH*
to the application.

Cygwin is intended to provide a Linux-like environment.  Linux
doesn't use backslashes as path separators, so you shouldn't expect
a backslash-separated path to work under Cygwin.  If you need to
pass a Windows path to a Cygwin program, use cygpath.

Regards,
Gary


--
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