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: Mangling of '\\' by cygwin dll


Hi Corinna,

C:\cygwin\bin>\cygwin\home\quetschke\slashtest_cyg.exe '\\\'
Arg1:\':
_Hmm, one \ escaped and one ' escaped, quotes vanish if not
escaped._

C:\cygwin\bin>\cygwin\home\quetschke\slashtest_cyg.exe \\\
Arg1:\\\:
_Nothing special for a non-quoted string._

What is the deeper plan for this functionality?

Quotes are not treated specially in cmd. But they are used in Cygwin to allow applications called from cmd to get values which are otherwise difficult to transport. The rules are fairly simple and match your obvservations. A backslash is always a special character. So a real backslash has to be written as \\, the quoting character itself as either \' or \", whatever you used for it. That's it, basically. So your example '\\\' is treated as an unfinished quote with two characters, a backslash and a single quote.
Thanks, yes my small sed problem showed me that I also had to escape
the used \s in that file even though the single \ was conserved it
somehow confused sed.

Consequently using \\ fixes this.

Volker


-- If you like my work consider: http://www.scytek.de/donations.html PGP/GPG key (ID: 0x9F8A785D) available from wwwkeys.de.pgp.net key-fingerprint 550D F17E B082 A3E9 F913 9E53 3D35 C9BA 9F8A 785D

Attachment: signature.asc
Description: OpenPGP digital signature


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