delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/01/09/00:03:45

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=aq_Ydt0_c_tyzxfGUgcA:9 a=snjkK-mFIzJpRIFwLzVuyaTKZkEA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10
Message-ID: <47845595.5040406@byu.net>
Date: Tue, 08 Jan 2008 22:03:17 -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, jmandawg AT hotmail DOT com
Subject: Re: need help with bash -c <command> with cygpath
References: <loom DOT 20080109T014917-334 AT post DOT gmane DOT org>
In-Reply-To: <loom.20080109T014917-334@post.gmane.org>
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 Jay on 1/8/2008 6:52 PM:
| When i run
|> bash -i -c "cygpath -a '\\uncpath\mydrive$'"

Whoa - it seldom makes sense to use -i and -c simultaneously - what good
is an interactive shell, if all it is going to do is execute a single
command sequence that works just fine non-interactively?  Drop the -i.

For that matter, why do you need to invoke another instance of bash to
call cygpath, when you've already stated that cygpath works just fine on
its own?

| Why do i get different results depending on how it is called?

Because you are calling it differently.  Try:

echo bash -i -c "cygpath -a '\\uncpath\mydrive$'"

to see what you were calling, and note that it wasn't a UNC path.  In
bash, "" and '' don't nest.  Therefore, the rules for "" apply, since that
is your outer quoting, and \\ simplifies to \, \m happens to pass
unchanged, and $' happens to pass unchanged (but other sequences would
have led to other surprises).

This is one way to do what you seem to want:

bash -c "cygpath -a '"'\\uncpath\mydrive$'\'

By the way, none of this tutorial on shell quoting is cygwin specific.

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

iD8DBQFHhFWT84KuGfSFAYARApImAJsENqjN54AbhvIP1uX6CgYHO5gZgwCgtOV4
lKmUlY5zgUsZGjWBt/aOPbw=
=F3eB
-----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