Me desconcierta por qué la variable $ lf no se imprime cuando se usa hexdump -C
Esta es una copia con comentarios agregados de una ejecución en el terminal bash de macOS 10.10.5.
mac $ lf=$(echo -ne "\x0a")
# What happened to the lf?
mac $ echo -n ${lf} | hexdump -C
# The lf seems to be working or should it be two blank lines?
mac $ echo $lf
# one lf as expected.
mac $ echo "" | hexdump -C
00000000 0a |.|
00000001
# only one lf as expected.
mac $ echo | hexdump -C
00000000 0a |.|
00000001
# since echo return an lf, why not use this fact to create lf
mac $ lf=$(echo)
# Why no lf?
mac $ echo -n ${lf} | hexdump -C
mac $ echo $lf
# one lf where I'd expect to see two.
mac $ echo ${lf} | hexdump -C
00000000 0a |.|
00000001
# cr seems to be working as expected.
mac $ cr=$(echo -ne "\x0D")
mac $ echo -n $cr | hexdump -C
00000000 0d |.|
00000001