[juneau-lug] Re: What does . mean?

  • From: "Tony Taylor (ISD)" <tony.taylor@xxxxxxxxxx>
  • To: juneau-lug@xxxxxxxxxxxxx
  • Date: Thu, 27 Mar 2003 13:28:52 -0900

Kevin Miller wrote:
> As a follow on to my previous message, in the script there are lines like:
> 
> test -s /etc/sysconfig/mail && \
>       . /etc/sysconfig/mail
> 
> and 
> 
> . /etc/rc.status
> 
> What does a single dot, sitting all by itself on the line do/indicate?
> 
> TIA...
> 
> ...Kevin

Normally, when you run a script, it runs in a "child" shell.  The parent 
shell never sees any environment variables that are set within the child 
shell.

The '.' tells the parent shell to mimic all the child's environment 
variable changes; so, if you want to create a script that modifies your 
path, sets up a CVSROOT environment variable, etc, you preface it with a 
'.'.

Try this: create a script with this line:

        PATH=$PATH:$HOME/tempbin

Then execute that test script, like this:

        ./testscript

Check your PATH:

        echo $PATH


Now try it with the .:

        . ./testscript
        echo $PATH

Hope that clears things up.

                        - Tony


------------------------------------
This is the Juneau-LUG mailing list.
To unsubscribe, send an e-mail to juneau-lug-request@xxxxxxxxxxxxx with the 
word unsubscribe in the subject header.

Other related posts: