Tips on Bash

Loop over a list with spaces

entries=( test/* )
for d in "${entries[@]}"; do
  echo "$d"
done

or

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for f in $( find "$1" -type d ! -path "$1" )
do
  echo $f
done
IFS=$SAVEIFS