How to modify a global variable within a function in bash?
When you use a command substitution (i.e., the $(…) construct), you are creating a subshell. Subshells inherit variables from their parent shells, but this only works one way: A subshell cannot modify the environment of its parent shell. Your variable e is set within a subshell, but not the parent shell. There are two ways to pass values from … Read more