Dies schrieb Pádraig Brady (p...@draigbrady.com):

> I was wondering about the logic in your example BTW.
> If there is no input then you'll process an empty chunk
> or if the input is an exact multiple of the chunk size
> you'll process an empty chunk at the end.

Yes, I have to admit that this is a side effect of the method
I described.

> The following addresses both issues and
> also uses existing coreutils functionality:
> 
> process_part() { echo processing $(wc -c) bytes; }
> while true; do
>   c=$(od -tx1 -An -N1)
>   test "$c" || break
>   c=$(echo $c) #strip leading ' '
>   { printf "\x$c"; head -c9; } | process_part
> done
> 
> cheers,
> Pádraig.
> 
> p.s. \x is not a printf standard so the
> script probably needs tweaking for dash

That's actually a neat idea, I'll see if I can adapt this
for my purpose. But you must admit that having a modified
'head' to replace the od/test/echo/printf part would be a
nice thing?

Reply via email to