d
Amit DhamuSoftware Engineer
 

Use Heredoc In Bash Script

1 minute read 00000 views

You can use heredocs to populate the contents of a file in a bash script. Remember you'll have to escape any special characters such as $.

cat > script.js << EOF
\$(function() {
    console.log('Hello');
});
EOF