On Monday, December 5, 2022 at 9:15:57 AM UTC+8, Ben Bacarisse wrote:
> "
hongy...@gmail.com" <
hongy...@gmail.com> writes:
>
> > On Monday, December 5, 2022 at 12:13:50 AM UTC+8, Ben Bacarisse wrote:
> >> "
hongy...@gmail.com" <
hongy...@gmail.com> writes:
> >>
> >> > On Ubuntu 22.10, I'm using the following shipped bash version:
> >> >
> >> > $ bash --version
> >> > GNU bash, version 5.2.2(1)-release (x86_64-pc-linux-gnu)
> >> Same here.
> >> > In my case, I've a bash script which has the following line in it:
> >> >
> >> > trap 'echo -en "\n*** Ouch! Exiting ***\n"; sudo kill -- -$(ps -o
> >> > pgid= $$ | egrep -o [0-9]+); exit 1' 2
> >> What's all the ps and egrep stuff for? Isn't the net effect just $$?
> >
> > I've a bunch of other processes spawned from this script, and I hope
> > to kill them all, so that the orphan process will not be left behind.
> Ed Morton called it! Did you read his reply?
I've read Ed Morton's valuable reply and am trying to find the root of the problem based on his comments. Still, it seems like a needle-in-a-haystack problem, at least for now.