bash heredoc

bash heredoc

reference article

  1. heredoc multi line comment

<< tips

hello world

tips

echo hello lina

  1. heredoc cat message

cat << tips

hello world

see you again

love story

tips

  1. heredoc redirection message

cat << tips > doc

hello world

see you again

love story

tips

cat doc

  1. heredoc with variable

music1="see you again"

music2="love story"

cat << tips

hello world

${music1}

${music2}

tips

  1. heredoc but variable but not replace

music1="see you again"

music2="love story"

cat << 'tips'

hello world

${music1}

${music2}

tips

  1. heredoc suppress tab space with - symbol

cat <<- tips

	hello world

	see you again

	love story


tips


原文地址:https://www.cnblogs.com/movit/p/14674976.html