delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/01/11/16:34:29

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Authority-Analysis: v=1.0 c=1 a=8YBfKGRHcpkA:10 a=xe8BsctaAAAA:8 a=zFE4OAI8_9LKRpBw2oIA:9 a=D5317SFLeyOi9PuDrr0A:7 a=YDXUsUJI9AyanqJvSGyg7WCrwyQA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10
Message-ID: <4787E0A0.3010102@byu.net>
Date: Fri, 11 Jan 2008 14:33:20 -0700
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: need help with bash -c <command> with cygpath
References: A<loom DOT 20080111T150132-291 AT post DOT gmane DOT org> <2D9E96311DCA4C48BF185EA6928BC7BB030AAB8D AT asc-mail DOT int DOT ascribe DOT com> <01a501c85470$647dde60$2e08a8c0 AT CAM DOT ARTIMI DOT COM>
In-Reply-To: <01a501c85470$647dde60$2e08a8c0@CAM.ARTIMI.COM>
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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Dave Korn on 1/11/2008 9:38 AM:
|   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

"'\\'" - the " quotes are stripped and \\ collapsed by cmd.exe => '\'
'\' - the ' quotes are stripped by bash on execution => \

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

Which means:

bash -vxc "ls -la \\\\\\\\UNC_PATH\\\\Dir"

will also work (8 leading \ converted to 4 by cmd, then 4 converted to 2
by bash, so that ls sees an argument with 2 leading \).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHh+Ce84KuGfSFAYARAkhJAKCnk3p+yhal3k/09fAKywhficzz0ACgi+TA
hVScKscjLyeHoc2Vx6LYiWM=
=eSTr
-----END PGP SIGNATURE-----

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