Here is a simple script with parameter (set -e):
#!/bin/bash
set -e
echo "begin"
read -r -d '' var <<- EOF
echo "hello"
EOF
echo "${var}"
I expected no errors here, but the output is just:
begin
And "echo $?" returns 1. Why is this happening? What is wrong with read command here. If I comment out "set -e", everything works fine.