Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-16-2014, 10:52 AM   #1
Registered: Dec 2013
Posts: 112

Rep: Reputation: Disabled
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 file and put in /etc/profile.d/. doing little research in google and created following lines in as:
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?
Old 09-16-2014, 11:04 AM   #2
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,863

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

echo $ZN_NODE
echo $ZN_ROLE
echo $ZN_QTP

Steve Stites
Old 09-16-2014, 11:05 AM   #3
LQ Newbie
Registered: Sep 2013
Posts: 10

Rep: Reputation: Disabled
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..
Old 09-16-2014, 09:48 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ksh read variable from text file and populate with content of shell variable WindozBytes Programming 4 09-17-2012 02:48 PM
Need help with script writing: Storing cmd in variable, print variable, then exe cmds Arodef Programming 3 01-17-2012 01:26 AM
problem while comparing awk field variable with input variable entered using keyboard vinay007 Programming 12 08-23-2011 01:44 AM
AWK a variable Ouptut to a new variable and using the new variable with the old one alertroshannow Linux - Newbie 4 02-16-2009 01:08 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration