Some time ago I had to test several shell scripts how they affect the running environment on Linux.
I ended up writing this simple script to help testing. This example script runs testsubject.sh script, and shows changes to enviroment variables the script causes.
# Script to handle file sending to server
env > env.1
set > set.1
env > env.2
set > set.2
sdiff -s env.1 env.2 |cut -d">" -f2
sdiff -s set.1 set.2 |cut -d">" -f2
rm set.1 set.2 env.1 env.2