Here Documents are useful when you want to create a file or append something to a file. When writing my own documentation and guides I always use here documents because I don’t want to use editors just command copy/paste.
Here is an example for creating a simple bash script:
# if you want to skip variable expansion use quotes
# cat << "EOF" > sample_script.sh
cat << EOF > sample_script.sh
#!/bin/bash
echo "This is a sample bash script"
EOF







