On Thu, Dec 2, 2010 at 11:49 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote:

> On Thu, Dec 02, 2010 at 07:04:57PM +0800, Clark J. Wang wrote:
> > Following command also prints nothing, confused :(
> >
> > for ((i = 0; i < 10; ++i)); do echo -n " $i"; done | while read v; do
> echo
> > $v; done
>
> The output from the first command in the pipeline does not end with a
> newline.  Therefore, 'read' in the second command returns 'failure'
> (non-zero) when it reads the first line of input, and your loop never
> iterates.
>

But is that reasonable? I think read should return success in this case
which makes more sense to me. Does the POSIX standards require that?

-- 
Clark

Reply via email to