I'm using the following in a bash script to replace a string with the contents of a file:
readonly changes=`cat changes.txt`
perl -pi -e 's/\${changesMarker}/'"$changes"'/g' changelog_template.html
The file "changes.txt" contains a few lines of HTML. Nothing extraordinary, just an unordered list, including the <UL> open and closing tags and the <LI> tags.
Perl keeps telling me:
Illegal division by zero at -e line 1, <> line 1.
I guess Perl is trying to evaluate the replace text? How do I fix this?
The file changelog_template.html is something like this:
<html>
<body>
What's changed:
${changesMarker}
</body>
</html>
The file changes.txt is something like this:
<ul>
<li>Fixed unicode error</li>
</ul>
${changeMarker}(or some variable with the same name which is not initialized anywhere) into whatever is contained in the file, surrounded by both single and double quotes. Which to say the least is very strange and confusing. Or you are trying to replace the same string with itself, for some reason. So, clarify your intent please.perl script.pl build/changes.txt changelog_template.html