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

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/


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