I tried using the following options to parse the *.sh files in a dir
(the name can contain spaces). But each of them breaks:
FILESSH=$(ls /mysh/*.sh)
echo "$FILESSH" | while read FILE ; do --- do something --; done
This does not break for any whitespaces in filenames
for FILE in $(echo $FILESSH) ; do --- do something --; done
This breaks for any space in the name
for FILE in /mysh/*.sh ; do --- do something --; done
echo "$FILESSH" | while IFS= read -r FILE ; do --- do something --; done
Code 1,3,4 breaks if no sh file is found in the directory (they goes in loop once)....Code 2 does not but it breaks for any space in filename Any better ideas..??