source your script, don’t execute it like ./foo.sh
or sh foo.sh
If you execute your script like that, it is running in sub-shell, not your current.
source foo.sh
would work for you.
source your script, don’t execute it like ./foo.sh
or sh foo.sh
If you execute your script like that, it is running in sub-shell, not your current.
source foo.sh
would work for you.