update variable in for loop bash code example
Example: assign global variable inside loop bash
The while-loop is executed in a subshell, so changes to the variable
inside the while-loop won't affect the external variable.
The while-loop is executed in a subshell, so changes to the variable
inside the while-loop won't affect the external variable.