|
| From: | Paul Jarc |
| Subject: | Re: effect of assignment to a shell variable inside while list is lost outside list |
| Date: | Fri, 24 Jan 2003 12:16:56 -0500 |
| User-agent: | Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (i686-pc-linux-gnu) |
"John Lumby" <johnlumby@hotmail.com> wrote:
> when I run this:
> typeset -i rc=1;line="";echo -e "line 1\\nline 2" | while read -r
> line; do { [[ "$line" == *1 ]] && rc=0 && echo "rc=$rc line=$line" &&
> break; };done;echo "rc=$rc line=$line"
>
> I see this:
> rc=0 line=line 1
> rc=1 line=
This is covered in entry E4 in the bash FAQ.
paul
| [Prev in Thread] | Current Thread | [Next in Thread] |