RE: Scope change in loops with "read" built-in

2024-04-02 Thread Linde, Evan
Greg, thank you -- this was exactly what I've been failing to find. And there's even a solution that looks good for my *actual* problem. -Original Message- From: Greg Wooledge Sent: Tuesday, April 2, 2024 3:35 PM To: Linde, Evan Cc: bug-bash@gnu.org Subject: Re: Scope chang

Scope change in loops with "read" built-in

2024-04-02 Thread Linde, Evan
In a loop constructed like `... | while read ...`, changes to variables declared outside the loop only have a loop local scope, unlike other "while" or "for" loops. So far, I have found this in every bash version I have tested (as low as 3.2.57 on an old mac and as high as 5.2.15). Nothing obvio