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

Re: why does "jobs | wc" not work?



In article <20021126104930.GE1937@xxxxxx>,
   Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> There seems to be a strange bug with the jobs command in
> zsh-4.0.4.  It seems that the output of the jobs command refuses
> to go into a pipe.

> This works:

>   $ sleep 1000 &
>   [1] 6262
>   $ jobs > foo
>   $ wc foo
>         1       5      29 foo   <--

> But this does not:

>   $ sleep 1000 &
>   [1] 6262
>   $ jobs | wc
>         0       0       0       <-- ?

> And also:

>   $ echo `jobs`

>   $

> Is there a specific reason why jobs generates no output when
> running in a pipe?

Because jobs is executed in a subshell?

This is not the case with jobs > foo. "true | jobs" is also OK.

> Note:  In pdksh and bash (as bash and sh), jobs works as I would
> expect; csh and tcsh work like zsh.

AFAIK, shells do not implement the pipe and jobs in the same way.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated (X)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