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 |
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.
|
 |
10-24-2006, 11:16 PM
|
#1
|
LQ Newbie
Registered: Oct 2006
Posts: 3
Rep:
|
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
|
|
|
10-24-2006, 11:38 PM
|
#2
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
|
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.
|
|
|
10-25-2006, 02:08 AM
|
#3
|
LQ Newbie
Registered: Oct 2006
Posts: 3
Original Poster
Rep:
|
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?
|
|
|
10-25-2006, 02:22 AM
|
#4
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
|
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.
|
|
|
All times are GMT -5. The time now is 08:08 AM.
|
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
|
|