The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Setting environment variable on a remote solaris machine using shell script eamani_sun Shell Programming and Scripting 1 05-30-2008 07:05 PM
:: in PATH environment variable gfhgfnhhn Shell Programming and Scripting 1 05-11-2006 08:29 AM
Path Environment Variable tancy Shell Programming and Scripting 3 04-08-2006 03:38 AM
HISTSIZE environment variable problem Kenneth2006 UNIX for Advanced & Expert Users 5 01-17-2006 06:57 AM
How does the PATH and MANPATH environment variable get set? vtran4270 UNIX for Advanced & Expert Users 3 08-22-2002 11:09 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 5
problem in getting the path of variable set in bashrc in my shell script

hi all

i have joined new to the group.

i have set an variable in my bashrc file.
.bashrc
PROGHOME=/home/braf/braf/prog
export PROGHOME


but while using it in my shell script its path is not taken and i had to explicitly give the export command to set the path.

in my script file
PROGHOME=/home/braf/braf/prog
export PROGHOME

if i give export the script is executing and taking the file from correct path but not directly from bashrc.

can anyone help me over this plz

Last edited by krithika; 05-24-2006 at 05:10 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 05-24-2006
Registered User
 

Join Date: Jan 2006
Posts: 43
I think you are executing the script by correct user.

If you have set varibale in your .bashrc file and then are you running the script under the same profile?

because evry time one logg's in .bashrc gets executed if not then it will not..
Reply With Quote
  #3  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 5
thanks nilesrex

but i am runing the script in the same user and in the same shell.
in the shell promt when i do echo , i get the correct path.
only the script i dont get it.

i hope i have understood ur question properly and replied.
Reply With Quote
  #4  
Old 05-24-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 555
You have to check your login shell, is it really bash? type command echo $SHELL to find out your login shell and then modify appropriate login file as per your shell.
Reply With Quote
  #5  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 5
i checked its also correct
/bin/bash is what i had used in my script file also
Reply With Quote
  #6  
Old 05-24-2006
Registered User
 

Join Date: Jan 2006
Posts: 43
Once you logged in to your login you can do echo $PROGRAM,

and check if this variable is getting set correctly if it is not that means ur .bashrc is not getting executed..
Reply With Quote
  #7  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 5
after loged in my user and if i give echo $PROGHOME it gives
/home/braf/braf/prog ie its giving the correct path...
but only inside the script its not getting the path properly and i had to do export again to get the correct path
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0