I had to write a bash script that have to find the directories in the current directory and that directories must have a name that start with a letter of the alphabet [A-z]. For shell I wrote:
find . -maxdepth 1 -name '[[:alpha:]]*' -type d and it's ok. But in the script I wrote:
#! /bin/bash files=$(find . -maxdepth 1 -name '[[:alpha:]]*' -type d) for FILE in $files; do echo 'you are in', $FILE; done; But, when it finds a directory with whitespace (ex. ./New Directory) the output is
./New Directory as it were 2 different directories. Why? How can i resolve this problem?
filesis set, it is too late for quoting$FILEto make a difference. mywiki.wooledge.org/BashFAQ/001