In the book "Beginning Portable Shell Scripting" by Peter Seebach there is an example how to list the contents of all subdirectories of the current directory:
#!/bin/sh
/bin/ls | while read file
do
if test -d "$file"; then
( cd "$file" && ls )
fi
done
I learned that parsing ls is bad and globbing should be prefered. Do you think the author chooses parsing because there is a portability issue?
I would do:
#!/bin/sh
for file in *
do
if test -d "$file"; then
( cd "$file" && ls )
fi
done
Thanks,
Somebody