Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Functions that start Jobs



On 29 Jun, Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> Because no other shell can do this:

>   % f() { sleep 10; echo foo }
>   % f
>   ^Z
>   zsh: 4022 suspended  f
>   % fg
>   [1]  + continued  f
>   [ time passes... ]
>   foo

I have 2 questions:

1) Is the function executed in the current shell? I don't understand
what happens exactly. What happens if Ctrl-Z is typed while a builtin
is being executed?

2) I tried this example (with 100 instead of 10, to have more time),
and after I typed fg, the sleep ends immediately (i.e., no time
passes). I have the same behaviour on two machines under Linux
(Linux/x86 and Linux/ppc). Is this normal?

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



Messages sorted by: Reverse Date, Date, Thread, Author