John Keeping <j...@keeping.me.uk> writes:
>> 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 "\\/".
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html