bash script echo heredoc code example
Example 1: bash here document to file
cat << EOF
The current working directory is: $PWD
You are logged in as: $(whoami)
EOF
Example 2: bash here document example
cat << EOF > file.txt
The current working directory is: $PWD
You are logged in as: $(whoami)
EOF