Date: Sat, 11 Feb 2023 22:54:47 +0900
From: =?UTF-8?B?5bKh6YOo5bCG5bm4?= <[email protected]>
Message-ID:
<CADE-OTFYU3av0YAn=XTa4hUx53SC8Ss_HE9JQ7b4fB=xtn+...@mail.gmail.com>
| "jobs" outputs to stdout, but "builtin jobs" does not
| output to stdout.
Your test is flawed. Processes in a pipeline are in a
subshell environment. That environment has no jobs, hence
no output.
But there is a special exemption for that, when 'jobs'
is the first command in the subshell. Then it reports
its parent's jobs table instead (this is to allow
j=$(jobs) to work mainly).
So jobs|whatever produces output, but builtin jobs|... does not.
To test whether builtin jobs writes to stdout, use
builtin jobs >/tmp/foo
instead. No subshell there, so it should work.
Why would you want to ever say "builtin jobs" though?
The jobs command has to be buikt in to work.
kre