|
From: | Cuong Manh Le |
Subject: | Re: Fwd: read builtin return non-zero status reason |
Date: | Wed, 24 Feb 2016 21:45:02 +0700 |
while read -d '' line; do echo "$line"; done < <(printf '1')
while read -d '' line; do echo "$line"; done < <(printf '1\0')
> > It's the same thing. "Reached EOF before seeing the delimiter" is the
> > whole, combined reason.
>
> How can we verify it?
>
> Stephane Chazelas also have the same opinion with me in his answer
> http://unix.stackexchange.com/a/265484/38906, that's error came from no
> delimiter found.
You're confused. There is no difference between the two things. They
are the two sides of the same check.
When read reads from stdin, it will either encounter EOF, or it won't.
If it encounters EOF, it returns nonzero. If it doesn't encounter EOF,
it looks to see if it found the delimiter character. If so, it returns
zero. If not, it continues reading.
That's literally all of the possible outcomes, apart from non-EOF errors.
[Prev in Thread] | Current Thread | [Next in Thread] |