2

I have this script (it is actually a snippet from a bigger script).

#!/bin/sh

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

When I run it, I get

./bugged.sh: 9: Syntax error: end of file unexpected (expecting "fi")

Apparently, the problem is the "EOF". Why does this happen and how can I achieve the same result (reading from myfile)?

8

Either stop indenting the EOF, or use <<-EOF earlier and indent it using tabs.

0

Ignacio explained the error you get, but you may want to simplify your code and avoid the here document in the first place like:

filepoint=$(od -An -j 8001 -N 1 -t x1 < myfile)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.