tiny patch to prevent head from closing pipes
swell.k at gmail.com
Sat Aug 28 14:58:23 UTC 2010
Anonymous <swell.k at gmail.com> writes:
> Alexander Best <arundel at freebsd.org> writes:
>> hi there,
>> i just had subversion complain about a broken pipe while piping its output
>> through awk straight to head . i decided to add a switch to head which will
>> tell it to never close a pipe unless the input has stopped .
> 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)
More information about the freebsd-hackers