How to avoid heredoc expanding variables? [duplicate]
Just use ‘EOF’ to prevent the variable from expanding: sudo /bin/su -c “cat << ‘EOF’ > /etc/init.d/my-script # ^ ^ From man bash: Here Documents This type of redirection instructs the shell to read input from the current source until a line containing only delimiter (with no trailing blanks) is seen. All of the lines … Read more