Re: Question about job control in non-interactive shells

2012-01-14 Thread Herbert Xu
Jilles Tjoelker jil...@stack.nl wrote:
 On Mon, Jan 09, 2012 at 10:37:45AM -0600, Jonathan Nieder wrote:
 Michael Welsh Duggan wrote:
  I am trying to determine why:
 
dash -c sleep 5  kill %1
 
  results in:
 
dash: 1: kill: No such process
 
 You are probably looking for the -m option.
 
 The cause is that the -m option (job control) enables running commands
 in separate process groups, and dash follows literally what POSIX says
 about kill %job: a background process group should be signaled; however,
 there is no background process group. Some shells signal one or more
 processes they know are part of the job in this case, but dash calls
 kill() on a process group that is guaranteed not to exist.

Right.  And you don't even need %1:

dash -c sleep 5  kill $!

works just fine.

Cheers,
-- 
Email: Herbert Xu herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about job control in non-interactive shells

2012-01-13 Thread Jilles Tjoelker
On Mon, Jan 09, 2012 at 10:37:45AM -0600, Jonathan Nieder wrote:
 Michael Welsh Duggan wrote:
  I am trying to determine why:

dash -c sleep 5  kill %1

  results in:

dash: 1: kill: No such process

 You are probably looking for the -m option.

The cause is that the -m option (job control) enables running commands
in separate process groups, and dash follows literally what POSIX says
about kill %job: a background process group should be signaled; however,
there is no background process group. Some shells signal one or more
processes they know are part of the job in this case, but dash calls
kill() on a process group that is guaranteed not to exist.

-- 
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about job control in non-interactive shells

2012-01-09 Thread Jonathan Nieder
Hi Michael,

Michael Welsh Duggan wrote:

 I am trying to determine why:

   dash -c sleep 5  kill %1

 results in:

   dash: 1: kill: No such process

You are probably looking for the -m option.

Thanks for writing, and hope that helps,
Jonathan
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html