Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Aug 2010 18:54:27 +0400
From:      Anonymous <swell.k@gmail.com>
To:        Alexander Best <arundel@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: tiny patch to prevent head from closing pipes
Message-ID:  <86mxs67pp8.fsf@gmail.com>
In-Reply-To: <86aao694tm.fsf@gmail.com> (Anonymous's message of "Sat, 28 Aug 2010 18:42:29 %2B0400")
References:  <20100828141625.GA69240@freebsd.org> <86aao694tm.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Anonymous <swell.k@gmail.com> writes:

> Alexander Best <arundel@freebsd.org> writes:
>
>> hi there,
>>
>> i just had subversion complain about a broken pipe while piping its output
>> through awk straight to head [1]. i decided to add a switch to head which will
>> tell it to never close a pipe unless the input has stopped [2].
>
> You can do same with sh(1), e.g.
>
>   $ svn log | (IFS=; while read li; do [ $((i+=1)) -le 10 ] && echo "$li"; done)

Hmm, draining pipe with cat(1) would be more efficient

  $ svn log | (IFS=; while read li && [ $((i+=1)) -le 10 ]; do echo "$li"; done; cat >/dev/null)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86mxs67pp8.fsf>