Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

while, true, do, done are all [bash] shell builtins. They are not running processes that can be suspended.

sleep(1) is the only process that can be suspended in this command. When you "fg", the suspended sleep(1) is signaled, and resumes. And then it exits.

When you do this in a subshell (in parens), you suspend/resume the subshell in its entirety, which capture the loop construct.

Why does it work in zsh?!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: