Suspending a for
loop (using Ctrl-Z), then resuming it with bg
specifically, will prevent it from iterating to the next instance. The for
loop still finishes the current iteration, but just stops there. The issue happens when sending the job to background only. No issue when using fg
.
Running in a subshell does not even help.
Context:
$ (for f in *.webm; do ffmpeg -fflags +genpts -i "$f" -map 0 -s hd1080 -c:v libx264 -preset slow -crf 20 -b:a 64k "${f%.webm}".mp4 > /dev/null 2>&1; done)
Is there a way to allow the for
loop to complete till the end after suspending/resuming to the background?