On Wed, Sep 21, 2011 at 01:09:32PM -0400, Pete Nelson wrote: > I'm confused about what exec is doing in this case. > > Sample script t: > > #!/bin/bash > echo $0 pid: $$ ppid: $PPID args: $* 1>&2 > if [ -z "$1" ]; then > exec $0 first | $0 second > echo should not reach here > fi
It does nothing. The $0 command being executed inside the subshell created by the pipeline is *already* being "exec"ed. > My intention is to give the second piped process the ability to send signals > to the first using its $PPID variable. mkfifo myfifo first > myfifo & first=$! second $first < myfifo & # Pass PID of first as an argument wait rm myfifo