Printf transforms \x0a into \x00

If

printf '\x0a' | xxd -cols 1

produces

0000000: 0a  .

then, why does

printf '%c' "`printf '\x0a'`" | xxd -cols 1

produce

0000000: 00  .

??

Because command substitution ( `command` or $(command) ) removes trailing newlines from the output of the commands performed.

2 Likes

I didn't know that! Thanks for the info.