Hello, I'm attempting my first script. I'm trying to do a loop that picks up all text files in a directory including all it's subdirectories. However whenever there is a space in the one of the directories the "for in" statement treats this as two separate file names. Is there any way of treating them the same?

Code:
for i in $(find . -name *.txt); do #i think I need to put quotes around something??
	echo $i
done

alternatively I was thinking I could

Code:
count=$(find . -name *.txt | wc -l);
for i = 1 to $count; do
	echo find . -name *.txt | wc -l #obviously I need to somehow only select one at a time
done
Any thoughts?