Shellscript function with directory-path

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?

Hallo,

Da dies hier ein deutschsprachiges Expertenforum ist, schreibe ich meine Antwort auf deutsch.

Call function for each folder

for myFolder in $(find „${c_my_startpath}SomeSubFolder/“ -name „*“ -type d)

Bash verarbeitet die Ausgabe des find-Befehls als Zeichenreihe mit dem Leerzeichen als Trenner. Ein Pfad wie „/Blub/SomeSubFolder/Good/Path/aa problem directory“ wird in die drei Strings „/Blub/SomeSubFolder/Good/Path/aa“, „problem“ und „directory“ aufgeteilt und die for-Schleife wird dreimal durchlaufen, mit myFolder="/Blub/SomeSubFolder/Good/Path/aa", myFolder=„problem“ und mit myFolder=„directory“.

Das kann mit folgendem Trick geöst werden:

find "${c\_my\_startpath}SomeSubFolder/" -name "\*" -type d | while read myFolder do

Gruß
Rainer

Vielen Dank!
Genau das war die Lösung.

Tait