Страхиња Радић <cont...@strahinja.org> writes:

Lapsus: the variable dirs should not be quoted here if it contains more than one directory to be passed to find. It is vulnerable to directory names containing spaces and weird characters, however.

So:

   cd "$target" &&
        find $dirs | sort | uniq > "$target_list"

To deal with spaces etc., one could possibly use something along the lines of the following kludge; it assumes that \n is relatively unlikely to be found in a directory name, and that the directories in $dirs can be separated by \n.

 cd "$target" &&
   echo "$(echo $dirs | while read dir
           do
             find $dir
           done)\n" | sort | uniq > "$target_list"


Alexis.

Reply via email to