Suppose I want to unzip files recursively that have the pattern ${file}*.zip in some directory /home/A/XML using find commandfind /home/A/XML -type f -name ${file}*.zip -exec unzip '{}' -d /target/path \;For now, I wish to parse a list of directories instead of just /home/A/XMLfor dir in ${path}; do            find ${dir} -name ${file}*\.zip -type f -exec unzip '{}' -d ${dir}/${file} \;doneI tries using a for loop to parse the directories but the unzip stop right after the 1st directories, meaning it done the same thing as the previous code, it only unzipped in the directory /home/A/XML.caution:  not extracting; -d ignoredI got the error above for the remaining directories.Can anyone please guide me on this? Thanks in advance.
Can list of directories be parsed into a find command?
bash;find;zip;for
If that list of directories is stored newline-delimited (one on each line) in a scalar variable $path (not a good name for a variable as it's special in several shells, though not bash), you'd do:IFS=$'\n' # split on newlineset -o noglob # disable globfor dir in $path # invoke the split+glob operator ($path unquoted)do  find $dir -name $file*.zip -type f -exec unzip -d $dir/$file {} \;doneIf $path was a bash array instead as in path=(dir1 dir2...), change the loop tofor dir in ${path[@]}If using GNU find, you may want to add a -quit predicate at the end or your find command to allow only one successful unzip per directory unless you want all the zip files to be merged into the same directory.Note that options should be placed before non-option arguments.