[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Global variables



On Sat, Jun 01, 2002 at 12:26:21AM -0400, Oleg wrote:
| On Saturday 01 June 2002 12:10 am, Maya wrote:
| > Thank you for the prompt reply.
| >
| > Actually what I'd like to know is the following: If '.bashrc' and
| > '.profile' are responsible for setting the individual users variables and
| > '/etc/profile' the global variables, why is it that if I set variables only
| > in the '/etc/profile', thus making them global, they are not viewed by the
| > system.

| > Could you please explain to me what I am doing wrong or if I had forgotten
| > something?
| 
| add the following to /ect/profile
| 
| export MY_VARIABLE=bla1
| 
| then log in as user. And I mean _log in_, don't just open a window shell. Do
| 
| env | grep MY_VARIABLE
| 
| if it doesn't show 
| 
| MY_VARIABLE=bla1
| 
| then you do indeed have a problem

Yes -- the problem is the user's .profile doesn't source the system
one.  It isn't automagically sourced.

Make sure the user's .profile looks like this :

if [ -f /etc/profile ] ; then
    . /etc/profile
fi

if [ -f $HOME/.bashrc ] ; then
    . $HOME/.bashrc
fi

and make sure their .bashrc looks like this :

if [ -f /etc/bash.bashrc ] ; then
    . /etc/bash.bashrc
fi


-D

-- 

Many are the plans in a man's heart,
but it is the Lord's purpose that prevails.
        Proverbs 19:21
 
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg

Attachment: pgpFOBhJJCxCK.pgp
Description: PGP signature


Reply to: