Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: detect pipe



On Sun, Feb 14, 2021 at 1:19 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> Note also that something like
>
>   { cat < file } <&-
>
> is OK (the <&- is useless here, but there might be cases where this
> could be useful).

I suppose

 ... | { exec <&- ; ... }

is useful for causing the upstream pipeline to get SIGPIPE and exit,
without waiting for the rest of the shell construct to finish.  Still,
that means the (previously) defined behavior is that anything spawned
by the rest of that construct has its stdin closed, so it still would
make more sense to require (syntactically enforce) { exec </dev/null }
here, if that was really the intent.




Messages sorted by: Reverse Date, Date, Thread, Author