Click to See Complete Forum and Search --> : exporting varaible local to the shell using bash script


mr_ss
06-07-2001, 08:50 AM
I want to export variable local to the shell.
i try with this code..

LIBPATH="opt/lotus/notes:/local/notesdata"
export LIBPATH

when i run the script ./test.sh on the command shell and type
echo $LIBPATH in the same shell
it dose not display anything.

plase tell me how can i export LIBPATH local to the shell so that when i write echo $LIBPATH , it should display the LIBPATH.

Thanks in advance for the helper.

TheLinuxDuck
06-07-2001, 09:09 AM
AFAIK, there isn't a way to do this, because when you are calling to a shell script, it is running it's own instance of the shell, be it sh, bash, whatever. Once that script is done running, the shell terminates and returns you to your existing shell.

If you need this variable in another shell, just use the method posted in the other thread you started here (http://www.linuxnewbie.org/cgi-bin/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=14&t=003091) or if you need it for a C/c++ program you're writing, just write out the path to a file (in the shell script), and open that in your C/c++ program.

Would you care to explain what you're after here, so that maybe we could help you with some alternate solutions?

[ 07 June 2001: Message edited by: TheLinuxDuck ]

mr_ss
06-08-2001, 02:21 AM
Actually , i want to run executable program
through the script that need some shared libraries at run time.So i have to set the environment varaible for that.

i try with the code.

# test.sh script file

#executable program

LIBPATH="/opt/lotus/notes:/local/notesdata"
export LIBPATH
./usr/local/bin/nxserver


But when i run the script, it give me the message "libraries not found".Any solution to this probelem?