using for-loop causes the loop to hang at filenames with -. Use while read instead with bash process substitution so it avoids the subshell problem.