LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-24-2006, 11:16 PM   #1
vori1973
LQ Newbie
 
Registered: Oct 2006
Posts: 3

Rep: Reputation: 0
Post Why I can't see environment variables from .bash_profile


I'm new with Linux OS and I'm trying to install Oracle on it.

I followed the instructions and added to .bash_profile several lines inorder to create Oracle environment variables, but than I type : echo $variable_name there is no value.

here is my file:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

#PATH=$PATH:$HOME/bin

#export PATH
#unset USERNAME

umask 022

PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
ORACLE_SID=orcl
LD_LIBRARY_PATH=$ORACLE_HOME/jdk/jre/lib/i386:$ORACLE_HOME/jdk/jre/lib/i386/server:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH

PATH=$ORACLE_HOME/bin:$PATH

export PATH
export LD_LIBRARY_PATH
export ORACLE_BASE
export ORACLE_HOME
export ORACLE_SID
 
Old 10-24-2006, 11:38 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Did you logoff and back in, or execute the profile in the context of the current environment? To do the latter, you must enter ". .bash_profile". That is, a period, a space, and then the name of the script (.bash_profile).

If you just re-run the script, a new bash environment is created for it, and that environment is destroyed when the script ends. Environment variables are a little tricky until you get used to them.
 
Old 10-25-2006, 02:08 AM   #3
vori1973
LQ Newbie
 
Registered: Oct 2006
Posts: 3

Original Poster
Rep: Reputation: 0
environment variables work only after I run scrip each time I login

Quote:
Originally Posted by macemoneta
Did you logoff and back in, or execute the profile in the context of the current environment? To do the latter, you must enter ". .bash_profile". That is, a period, a space, and then the name of the script (.bash_profile).

If you just re-run the script, a new bash environment is created for it, and that environment is destroyed when the script ends. Environment variables are a little tricky until you get used to them.

I run script as you suggested and it worked but than I loged out and loged in again variables there not saved.
Can I do something so this script will run always on user login.

p.s. I modified script as root and realised that user can't run it so I gave permissions 775 to the script.
does it mean that I suppose to edit this script in the beggining as user?
 
Old 10-25-2006, 02:22 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Each user has a .bash_profile. The permissions should be 644, and the ownership should be the user whose home directory the script is in. Normally a script needs a 7xx permission, but the profile is sourced, not directly executed.

If you want to change variables system-wide, you need to change the /etc/profile instead. Some distributions have a /etc/profile.d/ directory, with settings by function and application. Learn how your distribution uses the profiles before making changes to avoid creating problems for other applications.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
environment variables Prakhardeep Linux - Software 3 10-06-2004 04:30 AM
environment variables in c++ s3b0 Programming 6 08-27-2004 10:19 AM
environment variables kakridge Linux - Newbie 1 07-14-2003 07:25 PM
Environment variables kdnt Linux - Newbie 11 11-01-2002 09:19 AM
environment variables aethereal Linux - Newbie 7 12-19-2001 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:08 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