LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-04-2009, 05:25 AM   #1
madhusudaniyaar
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Arrow How to set the environment variables in BASH shell (RHEL)


I've written a shell file in bash shell which has to set the environment variables. So, that i can call that file from some other shell programs.

The contents of my shell file looks like as below

JAVA_HOME=/usr/java/jdk1.5.0_18
export JAVA_HOME
POSIDEX_HOME=/home/posidex/posidex_n/hdfc
export POSIDEX_HOME
CLASSPATH=$POSIDEX_HOME/extlib/psxrpgeneric.jar:$POSIDEX_HOME/extlib/posidex.jar:$POSIDEX_HOME/extlib/classes12.jar:$POSIDEX_HOME/extlib/log4j_12.jar:$POSIDEX_HOME/extlib/mail.jar:$POSIDEX_HOME/extlib/activation.jar:$POSIDEX_HOME/prop
HASH_LOGGER_PROPS=$POSIDEX_HOME/prop/loggerhash.prop
export HASH_LOGGER_PROPS
ORP_LOGGER_PROPS_CUST=$POSIDEX_HOME/prop/loggercust.prop
export ORP_LOGGER_PROPS_CUST
ORP_LOGGER_PROPS_APPL=$POSIDEX_HOME/prop/loggerappl.prop
export ORP_LOGGER_PROPS_APPL
ORP_LOGGER_PROPS_TIPS=$POSIDEX_HOME/prop/loggertip.prop
export ORP_LOGGER_PROPS_TIPS
PRIMEPROP_SKEL_HOME=$POSIDEX_HOME/prop/enginepropskel/primematch
export PRIMEPROP_SKEL_HOME
PRIMEPROP_HOME=$POSIDEX_HOME/prop/engineprop/primematch
export PRIMEPROP_HOME
DBPROP_HOME=$POSIDEX_HOME/prop/dbprop
export DBPROP_HOME


The problem is the above things are worin' out
After running the shell file if i check
echo $JAVA_HOME
it displays nothing what could be the mistake
 
Old 06-04-2009, 05:36 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Did you run echo $HAVA_HOME in the parent shell.
 
Old 06-04-2009, 05:41 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Are you executing the script or parsing it?

If you execute it the variables will only be accessible in the child shell, _not_ the shell you executed the script. If you parse the script the variables are accessible in the parent (mother) shell.

Executing: ./file
Parsing: . file (there's a space between the dot and the file)

Hope this helps.
 
  


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
How do you set environment variables leland9000 Linux - Software 1 04-01-2008 05:44 PM
how to set environment variables in bash profile praveenkorukonda Linux - Newbie 1 02-22-2007 12:40 AM
how do i set environment variables? guitarfella Slackware 2 12-05-2004 12:05 AM
How to set environment variables anjaan Linux - General 3 06-10-2004 03:04 PM
Help with the currently set environment variables!! apoc013 Linux - Newbie 6 01-21-2004 02:28 AM


All times are GMT -5. The time now is 06:57 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration