There are two ways to run a script in the bash shell (what you are
most likely to use), as well as other shells I've used.
The obvious way:
abc@flenser$ ./foo
starts another bash shell running as a child of your current bash
shell. This shell runs the commands and exits.
The other way, sourcing a script is done like this:
abc@flenser$ . foo
(notice the space between the "." and "foo") This method causes your
current shell to execute the commands in the script rather than
starting a new shell to do it. The reason you might want to do this is
that any changes you make to the environment when you source a shell
affect the shell that you are running interactively, the other way
does not allow this.