Re: [PATCH v2] rebase -i: respect core.commentchar
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:08
John Keeping [off-list ref] writes:
quoted
I am not sure if I understand what you meant by "literal backslash blah blah", though.It turns out that having this in the script works (in bash and dash although I haven't checked what Posix has to say about it): sed -e "2,$ s/^/\\\/" and is equivalent to: sed -e '2,$ s/^/\\/' because backslashes that aren't recognised as part of an escape sequence are not treated specially.
That's POSIX. Inside a dq pair:
\
The <backslash> shall retain its special meaning as an escape
character (see Escape Character (Backslash)) only when followed by
one of the following characters when considered special:
$ ` " \ <newline>
So in your example "\\\/", the first backslash escapes the second
backslash and together they produce a single backslash, the third
backslash is followed by a slash that is not special at all, so it
produces a second backslash, and the slash stands for itself,
resulting in "\\/".