The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-04-2008
unilover unilover is offline
Registered User
  
 

Join Date: Mar 2008
Location: Toronto, Canada
Posts: 66
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.