delimited by end-of-file (wanted `EOF’)

When you create a file in a script and use an end of file delimiter,

if ...
  cat <<EOF> $chef_dir/attrib.json
    $json
  EOF
fi

and you indent the word EOF to look nicer, you will get the error message

warning: here-document at line … delimited by end-of-file (wanted `EOF’)
STDERR> …: line …: syntax error: unexpected end of file

To correct the script, move the EOF to the beginning of the line

if ...
  cat <<EOF> $chef_dir/attrib.json
    $json
EOF
fi

Leave a comment

Your email address will not be published. Required fields are marked *