Here DocsΒΆ

cat << EOF > filename.sh
#!/bin/bash -e

# bunch of scripty stuff
##

EOF