Click to See Complete Forum and Search --> : problem in execuitng the binary in a bash script


mr_ss
06-08-2001, 06:47 AM
I want to execute a program in a script.
the executable needs some shared libraraies at run time..
the code is like...

#test.sh
#script file that contains the binary.

#setting the path varaibles

LD_LIBRARY_PATH="/usr/local/nxserver/lib" NOTES_PATH="/opt/lotus/notes/latest/linux:/local/notesdata"
PATH="$PATH:$NOTES_PATH:/opt/lotus/notes/latest/linux/res/C"

#calling the executable file here
/usr/local/bin/nxserver databasePath

#databasePath is command line argument

now when i run this script it gives me an error message that "can not find shared libraries"
However if i define the above path variables in the /etc/profile, logout and then do login again,the script works fine.

can anybody tell me is it possible to do that without defining the path variables in the /etc/profile.Any alternate solution to this?


Thanks in advance!!!

kmj
06-08-2001, 08:48 AM
(?) uh, I know jack about shell scripting, but you may need to export those variables before you can use them. (?) It's worth a shot anyway.

export LD_LIBRARY_PATH, PATH

satchel
06-08-2001, 12:38 PM
kmj is on track. You need to source(run) the file that contains these variables within you calling shell script. If you have these variables in /etc/profile(...in the form EXPORT variable_name=value) then just run /etc/profile at the beginning of your shell script like so ....

. /etc/profile

...this will make the variables available to your shell script.

satchel
06-08-2001, 12:40 PM
oh sorry ...you don't want them in /etc/profile...well just put them in another file and do the same...

satchel
06-08-2001, 01:16 PM
I had incorrect export syntax before...I meant a seperate file /etc/whatever_profile that looks like this...

#!/bin/sh
#/etc/whatever_profile
#might not need quotes around these values

export LD_LIBRARY_PATH="blah blah"

export NOTES_PATH="blah blah"


etc...

then your calling shell script...

#!/bin/sh
#test.sh

. /etc/whatever_profile

#call your executable(s)

mr_ss
06-11-2001, 02:22 AM
Thanks satchel for your valuable , i use it and the problem is solved....also thanks for kmj for his help....

:)