R – Why does this bash script require me to press enter to continue


I was kindly helped a few minutes ago by a user named Juliano and the script works fine but it just baffles me why it continues to work when I press enter, if I don't it just sits there untill I have to keep pressing enter. I thought that was the job of the for loop?

    for file in /home/test/videos/* ; do
     #for loop 2
     for (( i = 0; i < 10; i++ )); do
      #for loop 3
      for ext in avi mpg wmv mov; do
          elapsed=$({ time ffmpeg -i "$file" -ar 44100 "${file%/*}/done/${base%.*}.$ext" &>/dev/null; } 2>&1)
          echo "$file $i $ext took $elapsed seconds"

Also can I swap for loops 2 and 3?

Thanks all


How can I also make use of the variable "i" in the for loop so that it concatinates at the end of the file. Is this correct:


Thank you for anymore help.

Best Solution

I already answered in the other question. It was ffmpeg asking you to overwrite the output file. Giving unique names (with $i in the filename) and passing -y to ffmpeg solves the problem.