How to avoid heredoc expanding variables? [duplicate]
This question already has an answer here: How to cat <<EOF >> a file containing code? 3 answers I'm trying to create a script file using substitution string from ENV but want also to prevent some from escaping export PLACEHOLDER1="myPlaceholder1Value" export PLACEHOLDER2="myPlaceholder2Value" sudo /bin/su -c "cat << EOF > /etc/init.d/my-script #!/bin/bash # ### BEGIN INIT INFO # Provides: my-script # Required-Start: \$remote_fs \$syslog # Required-Stop: \$remote_fs \$syslog # Should-Start: \$network \$time # Should-Stop: \$network \$time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short