Script has to log everyting in it to output and to log file
Like this it works OK:
#!/usr/bin/env bash
some_command_1
((
echo "Some text (in parenthness too)"
echo "Another text without them"
) &2>1 )|tee log.txt
some_command_2
exit 0
It outputs to stdin/stderr and to log file as expected.
But this script:
#!/usr/bin/env bash
some_command_1
((
cat <<EOF
Some text (in parenthness too)
Another text without them
EOF
) &2>1 )|tee log.txt
some_command_2
exit 0
Produces an error:
warning: here-document at line 9 delimited by end-of-file (wanted `EOF')
Another text without them: command not found
./tmp.sh: line 11: EOF: command not found
ESCaping like this "(" does nothing.
Why?