I need to read in a php template file in a bash script, then replace some variables in the template (can be anything, like $(variable)
), and finally output the whole content to a new file.
I originally had
stuff=$stuff bash templatefile > newfile
for non-PHP files
cat <<END
//stuff
END
But my php template file looks something like
#!/usr/bin/php
<?php
//lots of php variables, so can't use bash variables that have the same $ prefix
?>
Because PHP also uses the $ prefix for its variables like bash, I can't easily pass in parameters. How would I go about it?