This question already has an answer here:
- While-loop subshell dilemma in Bash 3 answers
Because I trapped into this myself, I asked a question and did give also the answer here. If find
iterates over what the command did find, this is executed from bash
in a subshell. So you can not fill an array with results and use it after your loop.
You have to change the syntax from:
to
In my case i can after this loop access the bash array
$lxcnames
:Hope that helps anybody.