Support shims that are sourced in bash

This change was done specifically to support virtualenvwrapper which
provides scripts that are supposed to be sourced into your current shell.
The BASH_SOURCE variable can be used determine the current file that is
being included.  BASH_LINENO can be used to determine if the current
execution is an invocations or sourcing of a file.  BASH_LINENO will
be 0 in a script invocation because there are no functions currently
on the stack.  Finally, if your a currently sourcing a file, do not
do "set -e" as that will cause the interactive shell to close on any
error.
Yes, use `set +e` in the block that does the sourcing.

Also, there should be a variable like `is_sourced`, which then would be set according to the different shells and used to determine if `source / .` or `exec` is being used.
I am trying to find a way to detect this in Zsh, but did not succeed yet.