LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 12-29-2016, 12:35 PM   #1
arun natarajan
Member
 
Registered: Jun 2014
Posts: 111

Rep: Reputation: Disabled
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 ~]#
 
Old 12-29-2016, 12:53 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
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.
 
Old 12-31-2016, 04:16 AM   #3
arun natarajan
Member
 
Registered: Jun 2014
Posts: 111

Original Poster
Rep: Reputation: Disabled
Thanks Mensawater.

It worked as u suggested.
Thanks for your additional info on /etc/profile.
 
1 members found this post helpful.
  


Reply


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
Bash to find all placeholder variables in a file and replace will real variables spadez Programming 6 11-26-2013 01:24 PM
Bash Script: parse active process stderr, strip, dump into variables, use variables TimeFade Programming 1 02-13-2010 07:09 AM
Enviroment variables in .bash_profile TL_CLD Slackware 8 07-22-2009 02:00 AM
variables in bash_profile hid from me Junior_DBA Linux - Newbie 3 08-25-2008 06:53 AM
Why I can't see environment variables from .bash_profile vori1973 Linux - General 3 10-25-2006 02:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:45 AM.

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