Skip to content

Tag: heredoc

Create a heredoc that doesn’t interpret anything

I’m writing a script for a friend who is not experienced with bash. The script generates a backup script, generates a crontab and runs crontab to create a cron job. I want to date these backups, so currently the script (what’s relevant) is: This, however, generates finalCutScript.bash with the dat…

How to cat <> a file containing code?

I want to print code into a file using cat <<EOF >>: but when I check the file output, I get this: I tried putting single quotes but the output also carries the single quotes with it. How can I avoid this issue? Answer You only need a minimal change; single-quote the here-document delimiter after …