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


posted @ 2021-04-18 22:45  MOVIT  阅读(38)  评论(0编辑  收藏  举报