|
The dot-command (e.g.: . myscript.sh) means read in the file in the current shell and execute it line-by-line
On the other hand, executing any of the following:
sh myscript.sh
ksh myscript.sh
myscript.sh
(assuming that myscript.sh has +x for me) results in calling a child shell and executing myscript.sh in the child's environment.
Obviously, in the first form, any change in the environment (i.e. by commands like "cd <another-directory>") will happen in the current shell while in any of the second forms, they are happening in the child's environment and the current one is left unchanged.
|