dear lazy web ... (UNIX pipes)

Radoslaw Zielinski radek at pld-linux.org
Sat Apr 19 19:45:56 BST 2008


Greg McCarroll <greg at mccarroll.org.uk> [19-04-2008 15:40]:
[...]
>     process_that_generates_output | grep something | head
[...]
> and so i experimented timing the first process with and without head
> as the final pipe, and in a very unscientific test it came out with
> the same result.

process_that_generates_output handles SIGPIPE?  HTH:

  $ perl -le '$SIG{PIPE}=sub{die"pipe"}; 1while print++$i' | perl -pe '$SIG{PIPE}=sub{die"PIPE"}' | head -n1
  1
  PIPE at -e line 1, <> line 11409.
  pipe at -e line 1.

-- 
Radosław Zieliński <radek at pld-linux.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://london.pm.org/pipermail/london.pm/attachments/20080419/0255d805/attachment.pgp


More information about the london.pm mailing list