updating LD_LIBRARY_PATH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting updating LD_LIBRARY_PATH
# 8  
Old 12-25-2010
Okay, I went ahead and change shell

Now I am in csh:
Code:
%echo $SHELL
/bin/csh
%setenv LD_LIBRARY_PATH /bin
%echo $LD_LIBRARY_PATH
/bin
%echo '#!/bin/csh' > test.sh
%echo 'setenv LD_LIBRARY_PATH /tmp:$LD_LIBRARY_PATH' >> test.sh
%cat test.sh
#!/bin/csh
setenv LD_LIBRARY_PATH /tmp:$LD_LIBRARY_PATH
%chmod 755 test.sh
%./test.sh
%echo $LD_LIBRARY_PATH
/bin

Now the parent shell and the subshell from the script is the same and it still doesn't work. The $LD_LIBRARY_PATH should have /tmp:/bin

Thanks

Last edited by Scott; 12-25-2010 at 08:54 PM.. Reason: Code tags, please...
# 9  
Old 12-26-2010
Dear casau,
You didn't get my point.

when you execute any script it invokes its own shell. The environments in the child shell doesn't return back to the parent shell.

If you do want to change the LD_LIBRARY_PATH for all always in the shell you are working on, you have to source the script.

There are many ways of doing that and the most common way is put the commands in your shell's profile which are .bashrc,.kshrc,.cshrc respectively for bash,ksh and csh shell exists in the home directory.

or even you can put the commands in any file, and source it. just like you were doing initially in login file.

so, if you are on bash shell, do this
Code:
$ echo 'export LD_LIBRARY_PATH=/tmp:/bin' > my_env
$ . my_env
$ echo $LD_LIBRARY_PATH
$ /tmp:/bin
$

if on csh,
Code:
% echo 'setenv LD_LIBRARY_PATH /tmp:/bin' > my_env
% source my_env
% echo $LD_LIBRARY_PATH
% /tmp:/bin
%

Hope you get it.
# 10  
Old 01-22-2011
Hi all......
please help me out..........
I have data/lib and newdata/lib those are two different utilities.........
if i set the lib of one utility the another one utility is not running fine.............
For example if i use export LD_LIBRARY_PATH=/abc/data/lib this should execute in data/apps folder.like this newdata also should run in newdata/apps folder
the newdata/lib files are not connecting to server so server is not running properly...........
please help me i want to run both lib folders at a time...............
plz give response as soon as possible
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with LD_LIBRARY_PATH

I am on Solaris . I have written a script callled T_1.sh #!/bin/sh ######################################################################################################## # # Source borne shell env.This is required for crontab to work as bip.sh uses environmental variables.... (24 Replies)
Discussion started by: rafa_fed2
24 Replies

2. Shell Programming and Scripting

Ld_library_path

Hi., Currently my LD_LIBRARY_PATH setting is, LD_LIBRARY_PATH=/opt/app/product/11.2.0/client_1/lib Now, I need to append the JAVA to this setting... Can I set this way, Please suggest. ... (4 Replies)
Discussion started by: nuthakki
4 Replies

3. AIX

Set LD_LIBRARY_PATH to 1 or empty

I have a question on setting environmental variable LD_LIBRARY_PATH. The case is that, i cannot execute wget on my AIX machine. It return the following error: exec(): 0509-036 Cannot load program wget because of the following errors: 0509-022 Cannot load module... (5 Replies)
Discussion started by: cstsang
5 Replies

4. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

5. HP-UX

SHLIB_PATH or LD_LIBRARY_PATH

hi Im using HP-UX 11i,PARISC .... Where do i find SHLIB_PATH or LD_LIBRARY_PATH , i couldnt find in env, listing...... Moreover im trying to execute file its throwing me error usr/lib/dld.sl: Can't find path for shared library: libgcc_s.sl /usr/lib/dld.sl: No such file or directory... (3 Replies)
Discussion started by: vasanthan
3 Replies

6. UNIX for Advanced & Expert Users

Difference between LIB_PATH and LD_LIBRARY_PATH

I would like to know the differences between LIB_PATH and LD_LIBRARY_PATH on Linux and SunOS. I am getting an error while loading shared libraries on Linux (Omni works build environment) as shown below: 1:tradewind/dataaccess/*.pcc... (1 Reply)
Discussion started by: shafi2all
1 Replies

7. UNIX for Advanced & Expert Users

Difference between LIB_PATH and LD_LIBRARY_PATH

I would like to know the differences between LIB_PATH and LD_LIBRARY_PATH on Linux and SunOS. I am getting an error while loading shared libraries on Linux (Omni works build environment) as shown below: 1:tradewind/dataaccess/*.pcc... (0 Replies)
Discussion started by: shafi2all
0 Replies

8. UNIX for Dummies Questions & Answers

Ld_library_path

Hi, can anyone explain this terrm? should we setup it ? Thanks (1 Reply)
Discussion started by: ccp
1 Replies

9. UNIX for Dummies Questions & Answers

Bash LD_LIBRARY_PATH?

Hello I have just tried to install ns-allineone-2.31 on cygwin cygwin is using the bash shell it asks for somethings to be put into the LD_LIBRAY_PATH, here is a snippet of what it says. (1) You MUST put /home/Chris/ns-allinone-2.31/otcl-1.13, /home/Chris/ns-allinone-2.31/lib, into your... (1 Reply)
Discussion started by: bysonary
1 Replies

10. UNIX for Advanced & Expert Users

cc, setuid, and LD_LIBRARY_PATH

Hi, This question deals with Solaris 2.8 and setuid programs. From research I've done so far, setuid programs ignore LD_LIBRARY_PATH; I've proven this and am OK with it. The thing I am not certain of how the C compiler is supposed to behave when it is invoked via a setuid program. Basically,... (0 Replies)
Discussion started by: WolfBoy
0 Replies
Login or Register to Ask a Question