I want to create a bash script from a bash script. The problem doing it with old echo style (example echo -e "some commands" > /path/to/file.sh) is the commands are interpreted and substituted by its values.
Googling I found this solution on this forum: Generating a bash script from a bash script
There, they use:
cat >/path/to/file.sh <<'EOF'
some commands
EOF
If I do a mini-script only with this, it works... the problem is while try to integrate in my big script... with a very basic "some commands"... it generates an error:
warning: here-document at line xxxx delimited by end-of-file (wanted `EOF') ./myscript.sh: line xxxx: syntax error: unexpected end of file
What am I doing wrong? can't be used this inside functions or what's the point of the error... I'm not sure of being understanding what error tries to say. Thank you.
EOFat the start of the line (i.e. no spaces before)?