list="$(Result "$VARDB" "$VAR2" - <<-EOT
SELECT d.day || '@' || t.mo
FROM daa a,dab b;
EOT)"
我收到以下错误:
warning: here-document at line 5 delimited by end-of-file (wanted `EOT')
该代码在bash版本3.2.25下运行良好,但它会在版本4.1.2下触发错误
答案 0 :(得分:2)
请改为尝试:
list="$(Result "$VARDB" "$VAR2" - <<EOT
SELECT d.day || '@' || t.mo
FROM daa a,dab b;
EOT
)"
这是因为 here-doc 从字面上开始使用任何字符串。因此,开头为EOT
,找到文件末尾而不是EOT
shell只看到EOT)
而非EOT