[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash: please provide an easy way to spawn a new process group from s
From: |
felix |
Subject: |
Re: bash: please provide an easy way to spawn a new process group from script |
Date: |
Sun, 1 Nov 2020 12:00:12 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sun, Nov 01, 2020 at 11:13:37AM +0100, clime wrote:
> On Sun, 1 Nov 2020 at 11:01, Oğuz <oguzismailuysal@gmail.com> wrote:
> >
> > You can use the loadable builtin `setpgid' if you have to. Assuming
> > BASH_LOADABLES_BUILTIN is set, this should work:
> >
> > enable -f setpgid{,}
> > { setpgid $BASHPID{,}; a | b; } &
> > setpgid $!{,}
> > kill -- -$!
>
> Hello, it doesn't work for me:
I've not found any reference about
kill -- -$!
but try this:
clear;tty=$(tty) tty=${tty#*/dev/};{
{ sleep 2; echo a ;} |
{ wc -c ; sleep 2; echo b ;}
} & ps --tty $tty fw; kill -s INT -$! ; ps --tty $tty fw
Seem make the job.
--
Félix Hauri - <felix@f-hauri.ch> - http://www.f-hauri.ch