when you use the syntax:
Code:
. <path>/script.sh #that is so called sourced script
CHILD=/tmp/test_scripts/child.sh
echo "Running Child Process, $CHILD"
. /$CHILD
the script will not run in a child process, but will be executed by the same shell. Therefore the variable ERROR
(export ERROR="It went bang and made my ears ring") will be visible in that shell (because it is not another one, not a parent process)
You cannot execute a remote script sourced, it is simply impossible (the same process cannot run on both hosts).
Also you can try the following:
ssh user@host script >/script.out 2>script.stderr
and you can handle the two files differently.