Thanks, Clark! However, I find it difficult to follow the explanation at the
first link and even more difficult to connect it to this case. So I'm not sure
I'm getting it right. Could you maybe explain what exactly happens in the code
I posted?
Regarding the second link, yeah I can see a few ways that the code in question
could be improved regarding passing the values from the function, but it's not
my code, so I wouldn't like to push for a change unless the problem is indeed
with the code and not with Bash.
Thank you.
Nick