Re: Question about job control in non-interactive shells

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

 



Jilles Tjoelker <jilles@xxxxxxxx> 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 <herbert@xxxxxxxxxxxxxxxxxxx>
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux