Re: change environment variable via script

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Darrin Chandler
Date:  
To: Main PLUG discussion list
Subject: Re: change environment variable via script
Alex Dean wrote:

> I'm using bash (on OSX). In ~/.bash_profile, I have a CVSROOT
> variable set so I can connect to 1 CVS server. I occasionally want to
> connect to another cvs server, so I wrote a shell script to set a new
> CVSROOT value for me. The script appears to set the value correctly,
> but it doesn't change my environment settings outside of the script.
> It seems like it's a global vs. local variable issue. (CVSROOT is set
> differently within the context of the script, but is the change is
> forgotten when the script exits.) I don't do shell scripts very
> often, so I'm probably missing something really obvious. How do I
> tell the script I want to change the value 'for real'?


export CVSROOT

Each shell gets a copy of the environment. Mods are local by default.
Think about it a moment and you'll see why it must be that way.

--
Darrin Chandler

http://www.stilyagin.com/

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss