Detect sourcing

This commit is contained in:
斟酌 鵬兄 2016-04-29 15:34:32 +08:00
parent 1aa8cd7af6
commit 2b215a8a7b

View File

@ -4,7 +4,11 @@ case $- in
*) return;;
esac
__SCRIPT=$( pwd )/$BASH_SOURCE
__SCRIPT=$BASH_SOURCE
echo $BASH_SOURCE | grep -q "^$( pwd )"
if [ $? -ne 0 ]; then
__SCRIPT=$( pwd )/$BASH_SOURCE
fi
# Source global definitions
if [ -f /etc/bashrc ]; then