bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "builtin jobs" does not output to stdout.


From: Chet Ramey
Subject: Re: "builtin jobs" does not output to stdout.
Date: Tue, 14 Feb 2023 10:51:36 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2

On 2/11/23 11:14 AM, Koichi Murase wrote:
2023年2月12日(日) 0:42 Robert Elz <kre@munnari.oz.au>:
Why would you want to ever say "builtin jobs" though?
The jobs command has to be buikt in to work.

`jobs' can be overwritten by a shell function. For example, when a
user wants to modify the behavior of `jobs' for interactive uses, a
typical solution is to override `jobs' with a shell function and call
`builtin jobs' in the overriding function.

I guessed you have asked this because `jobs' would be specified as a
special built-in utility [XCU 2.14], which cannot be hidden by a
shell-function name, but it doesn't seem to be the case actually;

There's no way `jobs' would ever be a special builtin. It's always been
UPE shaded (User Portability). Job control wasn't even mandatory in
POSIX until Issue 6 (2004), and the specification that jobs can be run
when job control isn't enabled came well after that.

The distinction between regular and special builtins has always seemed
arbitrary -- special builtins are defined in terms of their effects, but
the only rationale for why those particular ones were chosen is "this is
what the Bourne shell did." Which is fine, but mostly an artifact of that
implementation; no discussion of why or whether it's a good idea to carry
that forward.


`jobs' doesn't seem to be specified to be a special built-in utility.

The 1988 Bourne shell didn't have it, so it can't be special.

I naively think that it is a valid request that `builtin jobs' would
behave in the same way as `jobs' in this context. POSIX also states
that the results are unspecified when the command name matches
`builtin' according to [XCU 2.9.1 / Command Search and Execution /
rule 1b].

Whether or not `builtin' is specified by POSIX isn't really relevant. That
list just means that some shells have implemented `builtin' as a builtin
command, so portable applications should take care with it.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]