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

Re: kill the LHS command of a pipe once the RHS command terminates



2019-06-29 03:24:33 +0200, Vincent Lefevre:
[...]
> Thus if the left-hand-side process has terminated, this tries to
> kill a random process!
[...]

Fair enough.

Then, how about:

page-and-kill() ("$@" | { ${PAGER:-less}; kill -s PIPE 0; })

(only for use from an interactive shell where that page-and-kill
is run in its own process group).

That would also kill the extra processes that the command may
spawn.

-- 
Stephane



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