脚本信息:

#!/bin/bash
function hello(){
cat <<YJT
echo "hello world!!!"
YJT
}
hello 

错误:

test.sh: line 7: warning: here-document at line 3 delimited by end-of-file (wanted `YJT')
test.sh: line 8: syntax error: unexpected end of file

解决:

是由于在末尾的YJT后面有空格导致的,YJT这个结束符的前面都不应该有空格,否则就会报错。

05-22 23:43