were my wrong assumptations .. sry .. peace .. On Wed, Dec 18, 2024, 10:57 PM Kaz Kylheku <k...@kylheku.com> wrote:
> On 2024-12-18 13:46, microsuxxor wrote: > > try > > > > p=$$ ; while sleep 1 ; do kill -USR1 "$p" ; done & > > That's not necessary; my existing repro steps successfully show > a difference between two signals, that being the only > difference between them. > > The $$ parameter is expanded to a decimal numeric word > *before* the while command is executed, so the background process > is referencing the correct PID of the parent. There is no need to > smuggle the PID through a variable. $$ in the while command will not > refer to the child process' > > (That would be an issue if we had used eval: > > eval 'command ... $$ ...' & > > now we backgrounded the eval, which then in the background > process parses the shell syntax and does all the expanding. > Now $$ is the PID of the background process, not that of > the shell which launched it.) > > > try also trap - USR1 in the new process ( the while loop ) > > We don't want that at all. The new process is just a helper > to generate the signal to our main process. It doesn't > receive the signal itself. >