# Set up _base, _self first # Keep track of which config set is loaded, to avoid loading a config set more than once if [ -z "${__BASH_CONFIG_LOADED}" ] || echo "${__BASH_CONFIG_LOADED}" | grep -qv " ${_self} " then __BASH_CONFIG_LOADED="${__BASH_CONFIG_LOADED} ${_self} " __BASH_CONFIG_DEPTH=$(( ${__BASH_CONFIG_DEPTH:-0} + 1 )) # Interactive shell? _i() { [[ $- == *i* ]]; return $?; } # Include all subfiles, in lexicographical order eval "$( ( [ -d "${_base}/${_self}.d/" ] && echo "${_base}/${_self}.d/" [ -d "${HOME}/.${_self}.d/" ] && echo "${HOME}/.${_self}.d/" ) | while read _path do find ${_path} -type f | sort done | sed -e 's/^/source /; s/$/;/' )" __BASH_CONFIG_DEPTH=$(( ${__BASH_CONFIG_DEPTH} - 1 )) [ "${__BASH_CONFIG_DEPTH}" -gt 0 ] || unset _base _self _i __BASH_CONFIG_DEPTH fi