1 # Set up _base, _self first
3 # Keep track of which config set is loaded, to avoid loading a config set more than once
4 if [ -z "${__BASH_CONFIG_LOADED}" ] || echo "${__BASH_CONFIG_LOADED}" | grep -qv " ${_self} "
6 __BASH_CONFIG_LOADED="${__BASH_CONFIG_LOADED} ${_self} "
7 __BASH_CONFIG_DEPTH=$(( ${__BASH_CONFIG_DEPTH:-0} + 1 ))
10 _i() { [[ $- == *i* ]]; return $?; }
12 # Include all subfiles, in lexicographical order
15 [ -d "${_base}/${_self}.d/" ] && echo "${_base}/${_self}.d/"
16 [ -d "${HOME}/.${_self}.d/" ] && echo "${HOME}/.${_self}.d/"
19 find ${_path} -type f | sed -e "s/[\\']/'\\\&'/g" -e 's#^'"${_path}"'\(.*\)$#\1 source '\''&'\'';#'
20 done | LC_ALL=C sort -t " " -k 1 | sed -e 's/^.* \(source \)/\1/'
23 __BASH_CONFIG_DEPTH=$(( ${__BASH_CONFIG_DEPTH} - 1 ))
24 [ "${__BASH_CONFIG_DEPTH}" -gt 0 ] || unset _base _self _i __BASH_CONFIG_DEPTH