The many related questions got me to a command the works as I want. Running this on the CLI shows the non-hidden (not starting with '.') directories and does not descend into them.
find /home/pbw10 -type d -path '*/.*' -prune -o -not -name '.*' -print
But if it's in a function, all of the directories are shown, as well as the files. The example is simplified from what I'm actually doing to make it clearer where the issue is.
runIt() {
thePath='/home/pbw10'
theCmd="find $thePath -type d"
theCmd+=" -path '*/.*' -prune -o -not -name '.*' -print"
# Show it.
echo "$theCmd"
# Runs it.
# This does not exclude the hidden directories (or files).
echo "$($theCmd)"
}
I rarely use bash functions, so I'm hoping this is something simple and obvious to those are more familiar with it.