« Back to Index

[Example of using cat to pass HEREDOC content into a file]

View original Gist on GitHub

Tags: #bash #heredoc #file

Pass HEREDOC content into file.sh

cat > foo.txt <<EOF
  content
EOF

# Alternative version
cat << EOF > ./sass/test.scss
body {
  p {
    &:hover {
      color: red;
    }
  }
}
EOF