(Note blank line in the output -- one newline from the echo command,
and one from the actual content of $myvar.) Using printf -v instead of
x=$(printf) means you don't suffer from the trailing-newline-removal
that command substitution does.
I'm a bit puzzled by the original e-mail, though. I don't see what the
actual goal is. If the goal is simply "put a newline character into a
variable", then this is even simpler:
myvar=$'\n'
my goal is very very stupid, like this
$ printf "%q" $(</bin/ls)
to get a "ascii form" of a binary file (something like uuencode)
but, as you can see, it does not work only for two binary chars
0x00, and 0x0a