跑shell脚本出错问题以及解决。

脚本信息:

#!/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这个结束符的前面都不应该有空格,否则就会报错。

 

posted @ 2018-12-24 10:29  北漂-boy  阅读(520)  评论(0编辑  收藏  举报