printf '%s' 'abc' | sed 's/./\\&/g' #1, \a\b\c
printf '%s' "`printf '%s' 'abc' | sed 's/./\\&/g'`" #2, &&&
printf '%s' "\a\b\c"
This is a good example to show difference between back-tick and
$(cmd) command substitutions.
When the old-style backquoted form of substitution is used, backslash retains its literal meaning except when followed by "$", "`", or "\". The first backticks not preceded by a backslash terminates the command substitution. When using the "$(COMMAND)" form, all characters between the parentheses make up the command; none are treated specially.
So take a look your example, I used
echo instead of
kent$ echo 'abc' | sed 's/./\\&/g' \a\b\c kent$ echo -E "`echo 'abc' | sed 's/./\\&/g'`" &&& kent$ echo -E "$(echo 'abc' | sed 's/./\\&/g')" \a\b\c
You can see, the back-tick command substitution made your
\\ as single
\, thus together with the followed
& it became
Note that I used
echo -E in order to disable the interpretation of backslash escapes so that the
\a\b\c could be printed out.