dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Can't kill a job
@ 2012-07-06 17:53 Seb
  0 siblings, 0 replies; only message in thread
From: Seb @ 2012-07-06 17:53 UTC (permalink / raw)
  To: dash

Hello,

I encounter a problem with the "kill" command. If I execute the
following script:

  #!/bin/sh
  sleep 2 &
  jobs -p %1
  kill %1
  wait

I get the following result:

  2636
  /tmp/debug.sh: 4: kill: No such process


The job is well seen by jobs, but mysteriously not by kill.

I've read the last messages relative to this question on the list.
These ones state the -m option should then be passed to dash. It
indeed fixes the problem, but it results in a very verbose output
useless in a non-interactive environment, and it does not prevent the
default behaviour to be IMHO somewhat inconsistent ("jobs %1" works,
"wait %1" works, but not "kill %1"). Moreover, it seems POSIX
encourages "kill" to work in the same way whatever the state of
the job control setting is:

 The jobs utility is not dependent on the job control option, as are
 the seemingly related bg and fg utilities because jobs is useful for
 examining background jobs, regardless of the condition of job
 control. When the user has invoked a set +m command and job control
 has been turned off, jobs can still be used to examine the background
 jobs associated with that current session. Similarly, kill can then
 be used to kill background jobs with kill% <background job number>.

 http://pubs.opengroup.org/onlinepubs/009695399/utilities/jobs.html
 ("RATIONALE" section)

So maybe it might be a good idea to change the default behaviour of
kill here. It would allow to increase the dash compatibility with the
other shells without betraying the POSIX standard (at least its
spirit).

My 2¢,
Seb.

P-S. BTW, on the same page (section APPLICATION USAGE), POSIX also
encourages to allow "$(jobs)" to work in the expected useful way.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-06 17:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 17:53 Can't kill a job Seb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).