If you want, for example, environment variables to stick around after they are changed, you run commands like this:
Code:
. asdf
# or
{ asdf }
This makes the script run in your existing process, not a subprocess.
Creating a subprocess or not creating one is only important when you want changes to things to stick around. If you do not want a cd command to actually change your current working directory after the code is done, then don't use the dot command. run the script in a subprocess.
subprocess is another word for "new shell"
If you put she-bang as the first line of a script you get a new shell
Code:
#!/bin/bash
cd /somewhere
ls something
creates a bash shell in a subprocess.
[/code]