5 ms·
Because ctrl-z will stop the current command, and when you run "fg" it resumes that one process. However, the loop you were in has been abandoned, and it will
by unpythonic 6y ago
Because ctrl-z will stop the current command, and when you run "fg" it resumes that one process. However, the loop you were in has been abandoned, and it will not continue to execute.
For example, try it with this:
for N in $(seq 10); do echo $N; sleep 1; echo $N; done
You'll see something like this:
$ for N in $(seq 10); do echo $N; sleep 1; echo $N; done
1
1
2
^Z
[1]+ Stopped sleep 1
$ fg
sleep 1
$
- mr-wendel 6y agoGreat point. Also, you may have things talking to external resources that are sensitive to timeouts ... even small ones. You may not be able to cleanly resume execution and cause an entirely new problem.
- indigodaddy 6y agoSo ctrl-c and up arrow wouldn’t work?
- ttsiodras 6y agoAfter so many months, I had no idea what tools I was running in that command line... And therefore, the effect of any signal seemed far more dangerous to me, than extracting the actual command from my shell's memory.
- indigodaddy 6y agoOk I get that
- wnoise 6y agoIn zsh, it resumes the entire loop.
- deleted 6y ago[deleted]