Re: I think bash logic in a loop like : while [ condition] |read somevar
From:
Chris Down
Subject:
Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.
Date:
Tue, 24 Dec 2013 16:29:51 +0800
User-agent:
Mutt/1.5.22 (2013-10-16)
On 2013-12-24 09:25:05 +0100, rens wrote:
> *read is a built in. there is no subshell.
$ echo "$BASHPID"; : | echo "$BASHPID"
26269
26271
> any way, it seems then to me that even IF "read" was a subshell, the scope
> of that would start and end with the read statement.
I don't know why you think that.
> thus, magically read in the subshell is making while a part of it's own
> shell ???
No, the pipe is.
> there is no "while|read" command, you see.....
>
> so "while" also invokes a shell ? that magically can do which you think is
> not possible ??
> because it is then the parent, not a child, evidently ?
>
> please explain......
The pipe creates the subshell.
> there is no read command in my path.
>
> so, with that out of the way, what is your comment ?
What does `read` have to do with anything?