[Bug 261200] Unable to pipe the output of jobs in sh

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 15 Jan 2022 16:22:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261200

--- Comment #2 from Ron Wills <ron@digitalcombine.ca> ---
(In reply to Graham Perrin from comment #1)

It's hard to tell if this is a feature or a bug. It's completely undocumented
from what I can tell.

As I do more testing, I can pipe the output of other builtin commands like echo
or pwd but not the command jobs. The shell /bin/sh isn't the only shell that
this doesn't work for.

$ bash jobs-test1.sh
...
*** Jobs ***
[1]   Running                       sleep 10 &
[2]-  Running                       sleep 10 &
[3]+  Running                       sleep 10 &
*** Job Count ***
       3
*** Jobs Piped ***
[1]   Running                       sleep 10 &
[2]-  Running                       sleep 10 &
[3]+  Running                       sleep 10 &
...

Works as expected.

$ sh jobs-test1.sh
$ tcsh jobs-test1.sh
$ zsh jobs-test1.sh
...
*** Jobs ***
[1]   Running
[2] - Running
[3] + Running
*** Job Count ***
       0
*** Jobs Piped ***
...

None of these pipe the output of builtin command jobs.

It just seems to be an odd feature to have this one command, to my knowledge,
not be able to pipe its output. I'm updating the testcase script to make the
output clearer.

-- 
You are receiving this mail because:
You are the assignee for the bug.