printf "\n" |hexdump -C
00000000 0a
printf "%s" $'\n'|hexdump -C
00000000 0a
if [[ $(printf "\n") == $'\n' ]]; then echo T; else echo F; fi
F
---- just noticed the problem doesn't happen if I try to use '\t' (tab)
printf "\t" |hexdump -C
00000000 09
printf "%s" $'\t'|hexdump -C
00000000 09
if [[ $(printf "\t") == $'\t' ]]; then echo T; else echo F; fi
T