I\'m writing a script that produces output in an unpredictable size, I want to know from inside the loop when the script has finished.
This is the code: