To get the string you want:
"/a_setting/c\\#{attribute} = something"
You need to escape the backslash by backslash.
- When you do
"\#"
, the"#"
is escaped, and is interpreted not as an interpolation element, but as the verbatim"#"
, which in inspection, appears as"\#"
in front of{...}
to avoid ambiguity with interpolation. - When you do
"\ "
, the" "
is (redundantly) escaped, and is interpreted as the verbatim" "
.