On Monday, January 16, 2023 8:41:14 PM CET Steffen Nurpmeso wrote: Hello Steffen, > So i think i am out of ideas except doing what Jilles suggested > in the message, enwrapping the inner thing with sh -c '..'. > [...] Yes, I am afraid it's the only syntax that works (but it is not very convenient). I had to remove /dev/null redirections for stdin and stdout to avoid getting a "Cannot set tty process group (Operation not permitted)" error. Finally, that gives, on FreeBSD: $ cat ./test.sh #!/usr/local/bin/dash /usr/local/bin/dash -c ' set -m ( sleep 1 ) & i=$! echo >&2 "inner Main shell has: $(ps -o pid,pgid $$)" echo >&2 "inner Sub-shell has: $(ps -o pid,pgid $i)" wait $i ' echo "outer Main shell has: $(ps -o pid,pgid $$)" $ ./test.sh inner Main shell has: PID PGID 20457 20457 inner Sub-shell has: PID PGID 20458 20458 outer Main shell has: PID PGID 20456 20456 Thanks again for your help! Cheers, Ganael. -- Ganael LAPLANCHE <ganael.laplanche@xxxxxxxxxxxx> http://www.martymac.org | http://contribs.martymac.org FreeBSD: martymac <martymac@xxxxxxxxxxx>, http://www.FreeBSD.org