This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: need help with bash -c <command> with cygpath


-----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@byu.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]