#!/bin/bash PHASE="PDT PRD" for CURRENT_PHASE in ${PHASE} do while read FILES do echo $FILES done < <(find /ama/si/PRD/ssr/StatsRepository/data/${CURRENT_PHASE} -type d -mtime +5 ! -empty -printf "%f\n") done #errors #sisup@server:/ama/si/PRD/ssr/scripts> sh -x test #+ PHASE=PDT PRD #l: line 7: syntax error near unexpected token `<' #l: line 7: ` done < <(find /ama/si/PRD/ssr/StatsRepository/data/${CURRENT_PHASE} -type d -mtime +5 ! -empty -printf "%f\n")'