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! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-29-2016, 12:35 PM
|
#1
|
Member
Registered: Jun 2014
Posts: 111
Rep:
|
variables in .bash_profile
Hi,
Below are the variables which i have in .bash_profile.
===================================================================
[oracle@server ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
TMP=/tmp;
TMPDIR=$TMP;
export TMP TMPDIR
ORACLE_HOSTNAME=server.example.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=ORCL; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=SALES; export ORACLE_SID
PATH=/usr/sbin:$PATH;
PATH=$ORACLE_HOME/bin:$PATH;
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; ex
CLASSPATH=$ORACLE_HOME/jlib:ORACLE_HOME/rdbms/jlib;
export PATH LD_LIBRARY_PATH CLASSPATH
[oracle@server ~]$
========================================================
when i tried to print the variables and change the directly using the variable, its not working.
Even rebooted the server, still the same.
May i know why and how to fix this ???
[root@server bin]# uname -a
Linux server 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@server ~]# echo $ORACLE_HOME
[root@server ~]#
[root@server ~]# cd $ORACLE_HOME
[root@server ~]#
|
|
|
12-29-2016, 12:53 PM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
At the beginning your prompt is:
[oracle@server ~]$
However, at the end your prompt is:
[root@server ~]#
This suggests the .bash_profile you are editing is for a user named "oracle" but when you run your echo later you're doing it as the "root" user.
Each user has their own .bash_profile (and .bashrc and/or .profile etc...). Making changes for one user has no effect on another user.
If you use the "su" command to switch user (e.g. if you are the "oracle" user and do "su" without specifying a user or "su root" it becomes the root user. Using su with no flags would cause it to inherit the environment of the user that did the su. However if you use the "-" with su (e.g. "su -" or "su - root") it tells it to invoke the target user's environment rather than inherit the original user's environment.
If the settings you want are global (i.e. you want ALL users to have them) you can modify system profiles such as /etc/profile. On login users would first load system profiles then load their own. So if you put a setting in the system profile and do NOT change or unset it in the user's profile it will be used by all users.
|
|
|
12-31-2016, 04:16 AM
|
#3
|
Member
Registered: Jun 2014
Posts: 111
Original Poster
Rep:
|
Thanks Mensawater.
It worked as u suggested.
Thanks for your additional info on /etc/profile.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 10:27 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|