Re: kill $! won't kill the last command in asynchronous list

2020-04-01 Thread Oğuz
> You have to start the job with job control enabled if you want the > background process to be its own process group leader, and at that point > the shell started to run the group command will not have job control > enabled and will run all processes in the same process group (its own),' > so you

Re: kill $! won't kill the last command in asynchronous list

2020-04-01 Thread Chet Ramey
On 4/1/20 12:16 PM, Oğuz wrote: > Thanks for the reply. > > 1 Nisan 2020 Çarşamba tarihinde Chet Ramey > yazdı: > > On 4/1/20 12:19 AM, Oğuz wrote: > > $ bash -c '{ sleep 15; } & pstree -p $!; kill $!; echo $?' > > bash(6955)───sleep(6959) > > 0 >

Re: kill $! won't kill the last command in asynchronous list

2020-04-01 Thread Oğuz
Thanks for the reply. 1 Nisan 2020 Çarşamba tarihinde Chet Ramey yazdı: > On 4/1/20 12:19 AM, Oğuz wrote: > > $ bash -c '{ sleep 15; } & pstree -p $!; kill $!; echo $?' > > bash(6955)───sleep(6959) > > 0 > > $ pkill -e sleep > > sleep killed (pid 6959) > > > > As seen above, kill $! doesn't kill

Re: kill $! won't kill the last command in asynchronous list

2020-04-01 Thread Chet Ramey
On 4/1/20 12:19 AM, Oğuz wrote: > $ bash -c '{ sleep 15; } & pstree -p $!; kill $!; echo $?' > bash(6955)───sleep(6959) > 0 > $ pkill -e sleep > sleep killed (pid 6959) > > As seen above, kill $! doesn't kill `sleep` if it's enclosed in curly > braces. Dropping curly braces, or execing sleep (e.g

kill $! won't kill the last command in asynchronous list

2020-03-31 Thread Oğuz
$ bash -c '{ sleep 15; } & pstree -p $!; kill $!; echo $?' bash(6955)───sleep(6959) 0 $ pkill -e sleep sleep killed (pid 6959) As seen above, kill $! doesn't kill `sleep` if it's enclosed in curly braces. Dropping curly braces, or execing sleep (e.g `{ exec sleep 15; }`) fixes this problem, but I