Blaine Simpson wrote:
>       "exit" doesn't exit the current shell when inside of PIPED read blocks,
>     yet everything works find if the input comes from "redirection".

This is because pipes operate in subshells and the exit applies to the
subshell.  Please see the bash FAQ question E4 for more information.

  ftp://ftp.cwru.edu/pub/bash/FAQ

>     cat /tmp/atf | while read; do exit 3; done  # for any text file /tmp/atf
>     Yet the following works
>     cat /tmp/atf | while read; do exit 3; done

Those two are the same.  You probably meant to say:

  while read; do exit 3; done < /tmp/atf

No pipeline there and so that is done in the current shell.

Bob


Reply via email to