Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Setting Environment Variables in a Shell Profile

  • 20-08-2002 11:17pm
    #1
    Closed Accounts Posts: 1,322 ✭✭✭


    I'm running Mandrake 8.2 (which includes bash)

    According to some text I've been reading; when an instance of a shell is loaded, environment vars such as $PATH are set in a file called /usr/.bash_profile. I had a look for that file and it didn't exist (and yes I used ls -a, to get hidden files). But I did find a copy of it in my home dir. So I edited that file, updating the $PATH var, and setting up a new $CLASSPATH var, for myself. In the script, I exported both vars, after init. But when I start a shell the vars have not been changed/created. So either I have done something wrong, or else that script is not executed.

    I want these vars setup under my account, and not global amonst all accounts, so it does make sense as to why .bash_profile would exist in my home dir. Also I could write a small script to do this myself, but since a script to init these vars upon startup already exists I would love to know where it is.

    Cheers, and advTHANKSance. ;)

    ;-phobos-)


Comments

  • Registered Users, Registered Users 2 Posts: 513 ✭✭✭Cond0r


    Right,

    Now i'm sure i'll be corrected if i'm wrong but...
    There is probably also a file called '.bashrc' and AFAIK, that file is executed if it's found, instead of the '.bash_profile' one. So hop the lines you want executed into that file and see if it works. :)

    Hope it helps.

    C.


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    When you login, bash will first load global profile and bashrc files. usually from /etc/profile and /etc/bashrc. Then it will load your local files, usually ~/.bash_profile and ~/.bashrc. Check all of these files to see if anything is interfering with anything else.

    http://www.gnu.org/manual/bash/html_chapter/bashref_6.html#SEC63

    adam


  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    Originally posted by bedlam
    put the file in your $HOME not /usr
    No the file was already in $HOME. The book I was reading told me that I would find it in /usr.... (so I'm assuming any version in there would be global to all accounts, which I don't want in this case).

    Anyway cheers for the help coz that worked! ;)

    I edited the .bashrc in $HOME and it was invoked upon startup after the global profiles scripts are loaded. So the var values got appended correctly.

    Cheers

    ;-phobos-)


Advertisement