ShellScript Call Function with Directorypath

Hello,

i wrote a code to call a function, the parameter when calling is a path to a directory.
the following code is simular:

# My Function
check_folder_content()
{
    # ...
}

# Call function for each folder
for myFolder in $(find "${c_my_startpath}SomeSubFolder/" -name "*" -type d)
do
    echo "DEBUG: call function with: ${myFolder}" >> $c_logFile
    check_folder_content "${myFolder}"
done

Now, when getting a Folder like this: "/Blub/SomeSubFolder/Good/Path/aa problem directory" the logFile says:

DEBUG: call function with: /Blub/SomeSubFolder/Good/Path/aa
DEBUG: call function with: problem
DEBUG: call function with: directory

So, the call is definitly wrong (3 times, but never the right path).

What must I change to fix this issue?

Thanks for answers,

Tait

Replace for by while/read :

# My Function
check_folder_content()
{
    # ...
}

# Call function for each folder
find "${c_my_startpath}SomeSubFolder/" -name "*" -type d | \
while IFS= read myFolder
do
    echo "DEBUG: call function with: ${myFolder}" >> $c_logFile
    check_folder_content "${myFolder}"
done

Jean-Pierre.

You'd have to enclose the (full) path within quotes, since otherwise the spaces contained will be interpreted as separators ... how about:

$(find '"${c_my_startpath}SomeSubFolder/"' -name "*" -type d)

The replacement of for by while as aigles sad was sucessfull.
Thanks a lot!

The quotes dosn't run, also I think i've got the double-quoutes, so that this wasn't the answer.

Best Regards,

Tait