EOF 阻止了我的脚本?

mic*_*con 2 bash shell-script here-document

我有这个脚本(它实际上是一个更大脚本的片段)。

#!/bin/sh

 if [ $actualsize -ge $MAXSIZE ]; then
  read dummy FILEPOINT <<EOF
  `dd if=myfile skip=8001 count=1 bs=1|od -x`
  EOF
 fi
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我得到

./bugged.sh: 9: Syntax error: end of file unexpected (expecting "fi")
Run Code Online (Sandbox Code Playgroud)

显然,问题是“EOF”。为什么会发生这种情况,我如何才能获得相同的结果(从 myfile 中读取)?

Ign*_*ams 8

要么停止缩进EOF,要么<<-EOF更早使用并使用制表符缩进。