LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Environemental Variable (https://www.linuxquestions.org/questions/linux-newbie-8/environemental-variable-4175519046/)

linuxmantra 09-16-2014 09:52 AM

Environemental Variable
 
Recently I got a ticket in which they want to setup environmental variable as:
Environment variables:
znenv: DEV
znqtp: CGP
zbnnode: 02
znrole: RD

Server is running RHEL6.4 and ticket suggested to create a zmp.sh file and put in /etc/profile.d/. doing little research in google and created following lines in zmp.sh as:
export ZN_ENVIRONMENT="DEV";
export ZN_NODE="02";
export ZN_ROLE="RD";
export ZN_QTP="CGP";

Can any one tell me, have I done the job correctly in above lines?

jailbait 09-16-2014 10:04 AM

You can check to see if your export commands worked by displaying the variables:

echo $ZN_ENVIRONMENT
echo $ZN_NODE
echo $ZN_ROLE
echo $ZN_QTP


----------------------
Steve Stites

vijay.kanta 09-16-2014 10:05 AM

Did you try the ~/.bashrc file? Correct me if I am wrong, you can write those "export" commands in that file and don't have to worry about them going away..

chrism01 09-16-2014 08:48 PM

After setting as suggested in the ticket, you'll need to logout and back in, as that location will cause them to be set for every user that logs in.
If you only want a specific user to get them (likely), then add to the appropriate .bashrc as suggested.


All times are GMT -5. The time now is 06:36 AM.