Overview How to iterate in bash All files matching a pattern for F in ./*.txt do echo "current: $F" done Loop over strings SOURCES=( "AA" "BB" "CC" ) for SRC in ${SOURCES[*]}; do echo "${SRC}" done Other Resources https://www.cyberciti.biz/faq/bash-loop-over-file/ https://www.digitalocean.com/community/tutorials/workflow-loop-through-files-in-a-directory