I need to display a bash script on a webpage without any formatting.
The bash script uses standard 'here document' blocks. When I try to output the script using the PHP heredoc function, it cuts off the output when it encounters a '<<' sub-string. I thought the PHP heredoc function did not require escaping.
How do I output this script correctly?
<?php
$string = $_GET["string"];
$bashscript = <<<MYMARKER
<pre>
#!/bin/sh
rm /tmp/blue.sh
cat <<INSTALL > /tmp/blue.sh
#!/bin/sh
cd /tmp
mkdir output
cd output
cat <<EOF > interface.conf
remote $string
EOF
INSTALL
</pre>
MYMARKER;
echo $bashscript;
?>
The output I get on the page is
#!/bin/sh
rm /tmp/blue.sh
cat < /tmp/blue.sh
#!/bin/sh
cd /tmp
mkdir output
cd output
cat < interface.conf
remote
EOF
INSTALL