You could get pid from $jobtexts? On Thu, 19 Jan 2023 at 15:43, Pier Paolo Grassi wrote: > I realize now the subject doesn't reflect the final version of the mail, > sorry for that > > Pier Paolo Grassi > > > Il giorno gio 19 gen 2023 alle ore 16:32 Pier Paolo Grassi < > pierpaolog@gmail.com> ha scritto: > >> Hello, I want to populate an array from a long running process, something >> like: >> >> long_running_process | while read line >> do >> array+=$line >> done >> >> problem is, since long_running_process does not continually produce >> output but only some times, when i try to interrupt this pipeline with >> ctrl-c I have to wait until it produces some output for the process to >> terminate (because, as I understand it, when it tries to write to the pipe >> it receives a sigpipe due to it being already closed) >> >> I have tried various constructs with trap and even coproc to be able to >> intercept the ctrl-c and send a sigpipe to the long running process, but to >> no result. >> >> I wonder if someone has some solution to share for this problem, thanks >> >> Pier Paolo Grassi >> > -- Best regards, Sebastian Gniazdowski