bash - \n in variable in heredoc -
Is there a Bash Hurdock to explain '\ n \' in a headlock?
I have got an archetype string in a loop for word1 word2 word3t in TCP_avr = $ i rate = "$ rate \ n $ tmp_avar"
/ Pre> And then I want to use the string created in a Hurdock:
cat & lt; & Lt; EOF & gt; Myfile HEADER == $ ret == Trailer EOF
However, I would like to interpret "\ n" the character as a new line, so that output is
Header == Word 1 word2 word3 == trailer
instead of
HEADER == \ nword1 \ nword2 \ nword3 == trailer
Is this possible? Or should I possibly build my initial string in any way?
You can use $ 'in Bash \ n' one To add a new line to the string:
ret = "$ ret" $ '\ n' "$ TMP_VAR" You can also use + = for:
ret + = $ "\ n '" $ TMP_VAR "
Comments
Post a Comment