Sujet : Re: (bash) How (really!) does the "current job" get determined?
De : naddy (at) *nospam* mips.inka.de (Christian Weisgerber)
Groupes : comp.unix.shellDate : 04. Oct 2024, 23:48:15
Autres entêtes
Message-ID : <slrnvg0s5f.1qk1.naddy@lorvorc.mips.inka.de>
References : 1 2 3 4 5 6
User-Agent : slrn/1.0.3 (FreeBSD)
On 2024-10-04, Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> wrote:
What? Scripting should not go anywhere near POSIX job control, which is
an interactive feature that requires a terminal session.
Well, there _is_ set -m.
>
And how will that devaluate what Kaz has said? Please elaborate.
Job control does not require an interactive shell or a terminal
session. It can be used in scripting. That's the facts.
or if you know of any useful and sensible application contexts
for non-interactive usages I'd certainly be curious to know.[*]
I'm curious myself. That said, here's something I stumbled across
recently:
background job &
...
kill %1 # clean up
What happens if the background job has already terminated on its
own accord before we reach the kill(1)? Not much, because with job
control, the shell knows that no such job exists. If you do this
with "kill $!", you signal that PID, which no longer refers to the
intended process and may in fact have been reused for a different
process.
-- Christian "naddy" Weisgerber naddy@mips.inka.de