When you run a shell script, you have two primary options:
./script.sh: This command runs the script in a new shell. Any variables set or changed in the script do not affect the parent shell.
source script.sh: This command runs the script in the current shell (no new shell is created). Any variables set or changed in the script affect the parent shell.