首页 > Linux > shell中提示警告错误:warning: here-document at line 8 delimited by end-of-file (wanted `EOF')
2019
03-18

shell中提示警告错误:warning: here-document at line 8 delimited by end-of-file (wanted `EOF')


错误信息:warning: here-document at line 8 delimited by end-of-file (wanted `EOF')


未命名1552878089.jpg


出错shell代码:

#!/bin/bash

source /etc/profile
ret=$(sqlplus -S /nolog <<EOF
connect sys/123456 as sysdba;
select * from v\$version;
EOF)
echo -e "$ret" | grep "Oracle Database"


以上代码执行时总是出现警告信息, 这里的EOF结束标记有问题。

注意: 结束标记的前后不要有空格等其他符号,所以独立写成一行就可以了。

修改后如下:

#!/bin/bash

source /etc/profile
ret=$(sqlplus -S /nolog <<EOF
connect sys/123456 as sysdba;
select * from v\$version;
EOF
)
echo -e "$ret" | grep "Oracle Database"


错误解决


本文》有 0 条评论

留下一个回复