really simple question but I can't seem to Google it. I want to tee a HEREDOC into a file and expand new lines from the variable.
user@host:~$ NEWLINEVAR="foo\nbar"
user@host:~$ tee -a > /dev/null filename <<HEREDOC
${NEWLINEVAR}
HEREDOC
Current result:
user@host:~$ cat filename
foo\nbar
Wanted result:
user@host:~$ cat filename
foo
bar
EDIT: I oversimplified my question. Edited above so it's using the HEREDOC implementation I need an answer for.