From Scorching Stork, 1 Week ago, written in Plain Text.
  1.     LoadSrcDir(){
  2.       # Lets do this the fun way \:D/
  3.       # BOOORING: `mapfile list <<<"$(printf "source %s\n" "$(find "${1}" -type f)")"`
  4.       shopt -s globstar
  5.       # Globstar the whole dir _with_ trailing '/'.
  6.       dirs="${1}/**/"
  7.       # Insert grep flags, and @ as a marker.
  8.       dirs="$(printf -- " -e %s\@" ${dirs})"
  9.       # Fill array with globbed targets.
  10.       # Remove trailing slash, $dirs is only actual directories. Then s/@/\$/ to
  11.       # Anchor the expr. Finally, run grep -e -e -e -e ... using the flags from above.
  12.       mapfile list <<<"$(printf "source %s\n" ${1}/** | command grep -v ${dirs//??@/\$})"
  13.       # First element is the dir from $1. not sure why its not caught by grep.
  14.       # Set it to something benign like a space.
  15.       list[0]=" "
  16.       #mapfile list <<<"$(printf "source %s\n" "$(find "${1}" -type f)")"
  17.       # Finally, call eval to run the embeded string 'source' as a command.
  18.       eval "${list[@]}"
  19.       shopt -u globstar
  20.     }
captcha