bash heredoc
reference article
- heredoc multi line comment
<< tips
hello world
tips
echo hello lina
![](https://img2020.cnblogs.com/blog/1095086/202104/1095086-20210418221625964-560339270.png)
- heredoc cat message
cat << tips
hello world
see you again
love story
tips
![](https://img2020.cnblogs.com/blog/1095086/202104/1095086-20210418221932715-1983942007.png)
- heredoc redirection message
cat << tips > doc
hello world
see you again
love story
tips
cat doc
![](https://img2020.cnblogs.com/blog/1095086/202104/1095086-20210418222552583-430985465.png)
- heredoc with variable
music1="see you again"
music2="love story"
cat << tips
hello world
${music1}
${music2}
tips
![](https://img2020.cnblogs.com/blog/1095086/202104/1095086-20210418223039082-277907214.png)
- heredoc but variable but not replace
music1="see you again"
music2="love story"
cat << 'tips'
hello world
${music1}
${music2}
tips
![](https://img2020.cnblogs.com/blog/1095086/202104/1095086-20210418223314813-1531038017.png)
- heredoc suppress tab space with - symbol
cat <<- tips
hello world
see you again
love story
tips
![](https://img2020.cnblogs.com/blog/1095086/202104/1095086-20210418225431181-1527031616.png)