【发布时间】:2014-07-17 13:47:25
【问题描述】:
在函数内部,我会有多个回显,但我记得我可以执行cat << EOF,然后是要输出的文本,然后是 EOF。但是,它似乎只在 EOF 部分没有缩进时才起作用,像这样
init(){
if [ conditionial ]; then
cat << EOF
this is some text
this is more text
this is even more text
EOF
但它不是这样工作的:
init(){
if [ conditionial ]; then
cat << EOF
this is some text
this is more text
this is even more text
EOF
有什么想法吗?
【问题讨论】:
-
它被称为“heredoc”,这是正确的行为
-
按设计工作...您可能想阅读
man bash...