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

Re: jobs command and pipes



"Owen M. Astley" <oma1000@xxxxxxxxx> writes:

> Why is it that the jobs command in zsh will not work with a pipe,
> although redirecting it to a file does work?

>From a practical point of view, it's surely obvious.  You can
implement

	A | B

by forking twice, redirecting I/O appropriately in the two children,
and then one child executes A, and one executes B.  I suspect

	jobs | wc

*does* work.  But the child process shell which executes the builtin
jobs doesn't have any jobs, so the result isn't interesting.

	jobs > foo

doesn't require jobs to be executed in a subshell, so it'll work as
expected.  (i.e., you get the list of jobs in the current shell,
rather than the empty list of jobs in a newly forked shell.)

So I think it's logical; probably a feature rather than a bug.  If
it's a bug, I wouldn't expect a fix soon.



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