not cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
with a matching popd at the end
Otherwise it can screw up parent scripts
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SELF=${0##*/} # aka basename DIR=${0%/*} # aka dirname