]> CyberLeo.Net >> Repos - CDN/bash-config.git/blob - bash-config/common
Explicitly avoid loading self more than once, instead of relying on symlink detection
[CDN/bash-config.git] / bash-config / common
1 # Set up _base, _self first
2
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} "
5 then
6   export __BASH_CONFIG_LOADED="${__BASH_CONFIG_LOADED} ${_self} "
7
8   # Interactive shell?
9   _i() { [[ $- == *i* ]]; return $?; }
10
11   # Include all subfiles, in lexicographical order
12   eval $(find "${_base}/${_self}.d/" -type f | sort | sed -e 's/^/source /; s/$/;/')
13
14   unset _base _self _i
15 fi