delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/01/11/11:39:04

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
References: A<loom DOT 20080111T150132-291 AT post DOT gmane DOT org> <2D9E96311DCA4C48BF185EA6928BC7BB030AAB8D AT asc-mail DOT int DOT ascribe DOT com>
Subject: RE: Re: need help with bash -c <command> with cygpath
Date: Fri, 11 Jan 2008 16:38:27 -0000
Message-ID: <01a501c85470$647dde60$2e08a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <2D9E96311DCA4C48BF185EA6928BC7BB030AAB8D@asc-mail.int.ascribe.com>
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 11 January 2008 15:51, Phil Betts wrote:

> If you absolutely MUST have backslashes, from cmd.exe, you need to
> double each backslash:
> 
> H:\>C:\cygwin\bin\bash -v -c '\\\\UNC_PATH\\Dir'
> 

  That doesn't work for me.  Adding the '-x' option to bash is very handy for
debugging these sorts of problems, it shows you what bash thinks it's actually
seeing:-


C:\Documents and Settings\dk>C:\cygwin\bin\bash -v -x -c '\\\\UNC_PATH\\Dir'
\\UNC_PATH\Dir
+ '\UNC_PATHDir'
/usr/bin/bash: \UNC_PATHDir: command not found


  I believe what is needed is 1) outer double-quotes, for cmd's benefit, 2)
inner single-quotes, for bash's benefit, 3) double up the slashes /as well/,
because there's one more level of quoting being stripped than I can account
for, but anyway it works for me:

C:\Documents and Settings\dk>C:\cygwin\bin\bash -v -x -c "'\\\\UNC_PATH\\Dir'"
'\\UNC_PATH\Dir'
+ '\\UNC_PATH\Dir'
/usr/bin/bash: \\UNC_PATH\Dir: command not found

C:\Documents and Settings\dk>


  If I wasn't trying to execute a directory but list it instead, I'd say

C:\cygwin\bin\bash -v -x -c "ls -la '\\\\UNC_PATH\\Dir'"

(just using this example to illustrate how the outer quotes protect the bash
commandline from cmd, and the inner quotes are part of the bash commandline).

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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

- Raw text -


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