// Note: OS X `find` does not support "-depth 1" (its -depth opt is for depth-first searching vs. breadth-first), just use an 'ls' with an 'if [ -d $filename]' to test for directories
find ~ -type d -depth 1 | while read filename; do # ls ~ | while read filename; do echo $filename # other stuff done
Note that the $ before the '\n' is just so the \n sequence is treated as a single character.