I am trying to put the name of the file I just made in my script into the text of the file, but I can't seem to find how to let it print out the $name in the file. Can someoene help me?

cat <<'EOF' >>$name
This file is named $name

1 Answer 1


Do not quote the string EOF. Do it like this:

cat <<_EOT_ >>$name
This file is named $name

If the delimiter is quoted no expansions are performed in the here-document:

If any part of word (EOT) is quoted, ... , and the lines in the here- document are not expanded.

  • so i am trying to compile a .java file in my vim script but it keeps giving the error "could not find or load main class name.java" while i have put a main class in my .java file, can u help with that? Commented Dec 28, 2017 at 15:40
  • @floriandewulf That is a java question, please open a new question, thanks.
    – user232326
    Commented Dec 28, 2017 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .