Re: exec vs. source spawning piped commands

2011-09-22 Thread Greg Wooledge
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 not

Re: exec vs. source spawning piped commands

2011-09-22 Thread Andreas Schwab
Pete Nelson writes: > 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 > > output: > > $ ./t > ./t pid: 13746 ppid: 12823 ar

exec vs. source spawning piped commands

2011-09-21 Thread Pete Nelson
$ bash --version GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the