After running the following command...
$ for i in {1..10}; do sleep 3; echo $i; done
...if I wait a few seconds and hit Ctl+Z, then I get the following:
1
2
^Z
[1]+ Stopped sleep 3
Now if I use fg
to resume the process, it resumes the sleep 3
part of the loop, but does not finish the loop:
$ fg
sleep 3
$
Is there a way to stop the process such that the loop can be continued later?