| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_TO_NO_BRKTS_FREEMAIL |
| X-Spam-Check-By: | sourceware.org |
| Date: | Thu, 9 Sep 2010 10:20:41 -0600 |
| From: | Morgan Gangwere <0 DOT fractalus AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Windows-style pathname does not work as command - why? |
| Message-ID: | <20100909102041.0531f7b5@snapdragon> |
| In-Reply-To: | <4C7FE938.6060806@redhat.com> |
| References: | <4C7FE2C2 DOT 8060104 AT fgm DOT com> <4C7FE938 DOT 6060806 AT redhat DOT com> |
| Mime-Version: | 1.0 |
| X-IsSubscribed: | yes |
| 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 |
--Sig_/cbGnb6S.KB3jJqycm.XC03D
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
on Thu, 02 Sep 2010 12:13:12 -0600, Eric Blake <4C7FE938 DOT 6060806 AT redhat DOT com>
attacked their terminal with
[stuff relating to Win32 paths]
Here's a sed script I use to get around that... Put this in your script (or
~/.bashrc) and enjoy
function wintocyg {
if [ "x${$1}" =3D=3D "x" ]; then
return 1
fi
echo $1 | sed 's/\([a-zA-Z]\)\:/\/cygdrive\/\1/g;s:\\:/:g'
}
This:
- checks that there is an argument.
- Converts that argument using a sed script that looks for a drive letter, =
:\
and converts that into a Cygdrive path. This works for root level stuff
("d:\") and for deeply nested things (like d:\ping\me_with\a hundred boxes
of\liquor).
Pretty Simple Stuff, but its a pain. I've used this for a while now.
I know its a hack but its /works/. You could easily make it escape ' '* but=
I'm
assuming you're calling it using "`wintocyg mypath`" ( /always/ escape your
paths )
* that would be done by taking and actually wrapping the entire function ar=
ound
an echo statement like =C2=AB echo "\"`echo $1 ...`\"" =C2=BB
--=20
Morgan Gangwere
Key ID A8B6F243, available from MIT.
BOFH excuse #441:
Hash table has woodworm
--Sig_/cbGnb6S.KB3jJqycm.XC03D
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQIcBAEBAgAGBQJMiQlZAAoJEEURiCSotvJDpj0P/0o1D4EuIFUfXOG4xA0pRXTW
MAO5fyuYhE4a65m1/CNWn/DU6qH0vWlHcCcq1Kwl0Gp87cF4jdJrbKFijiMdlcl2
hX8/+EiB3IrVlg7BYhm8/5Tcf1hpQMiIT93o4Tuf0iHcmcj04DziHD5ziRVt8p3I
cW7/+HtLFZ4Y1D6C3Qv5RC6n8yQdjuRgw4WkNooeJmO5QDlwfo8R5SAzB3uQ3Wwe
6t0+bsLqfmlOWTrgLzZdJnFB1D92fzCRfFylkFn+iR1HAzCSGHpowE4IOli8HFCE
Lg3aRhwboQTn/gNJufsk0gRCU9Y6TNG48MUSQuYNDdFhWI/A5pOvp0LD/KwCupcu
BRjTYUC3yVKO/G/wPywMGUG4uunszh7n4VWih9F4e4L9SywbWGTteJMFDpie2EYH
aElHt2PZgtznFUObt92pem0fPsMQZAckSlAPeYYaK404Nk1mSiEBZlGszlz7SqwX
gFoHUmp0/4dKLC3fYtNlAc478PSJJ+F6wLcwTg8CLGlnKKheYffoqGN4E4FLpva1
33G4BFwF4FX1t1gDc8nGkLrYpDE+bp4mZ6LCMXMfrols+HZvROo8h9BybjW29rqV
AosIZr8XV4bPg4qtRE/YILPPasUAM0ezIe1F37ONy5vWOq1qG8FdGH81CsL9O9/4
MjmdhOZ1Mnl4tpBj5IJ6
=SE8m
-----END PGP SIGNATURE-----
--Sig_/cbGnb6S.KB3jJqycm.XC03D--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |