Ravi Sir's Cards › AWS
Variable empty after a pipe loop?
This interview card answers: Variable empty after a pipe loop? Pipe runs the loop in a subshell. Feed it with < <( ). Or shopt -s lastpipe.
Read card text
What this card says
What it is
Pipe runs the loop in a subshell.
Why it matters
Feed it with < <( ).
done < <(cmd)
How / example
Or shopt -s lastpipe.