1 Kasım 2020 Pazar tarihinde clime <cli...@gmail.com> yazdı: > On Sun, 1 Nov 2020 at 11:01, Oğuz <oguzismailuy...@gmail.com> wrote: > > > > > > > > 1 Kasım 2020 Pazar tarihinde clime <cli...@gmail.com> yazdı: > > ... > >> > >> Please, provide a syntactic construct to spawn a new process group (or > >> at least there should be some usable command to do that). > >> > > > > 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: > > $ export BASH_LOADABLES_BUILTIN=1
by set, I meant to a path where loadable builtin binaries reside > $ enable -f setpgid{,} > bash: enable: cannot open shared object setpgid: setpgid: cannot open > shared object file: No such file or directory > > Also it looks quite complex. Why isn't there a simple (already > enabled) builtin e.g. like: > > newpgid { a | b; } & pid=$! > > where pid for `{ a | b; } &` will be stored in pid and will be also > the new gpid of the spawned process group. > > Work with process groups should be natural in bash. It can't be that > complex. I struggled with this for several hours and found lots of > people on the net that struggled with the same problem too. > > (in the end, i needed to do a helper function which uses ps to > recursively collect children of that process and then i passed all > those children to kill which is probably valid but one would expect > bash can do this in a better way and this really delayed my work). > > Thank you very much > clime > > > > > > >> > >> Thank you > >> clime > >> > > > > > > -- > > Oğuz > > > -- Oğuz