The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #8 (permalink)  
Old 01-14-2004
kduffin's Avatar
kduffin kduffin is offline
UN1X
 

Join Date: Nov 2003
Location: Virginia
Posts: 441
Ygor is correct. You use . to prevent a "fork" from occuring when you execute the script. Keep in mind, if you just want the script to cd to the directory and then perform som functions, that will work within the script just fine.

Consider the following script:

cd /tmp
pwd

If you run the script, it echos out /tmp as the path - thus any operations that follow in the script will take place in /tmp. When the shell terminaties, you will not be in /tmp, but in your starting directory. If you want the script to leave the running shell in that directory, use:

. script

Cheers,

Keith