LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-17-2006, 02:27 AM   #1
mac1234mac
Member
 
Registered: Sep 2005
Posts: 183

Rep: Reputation: 30
problems with export (path)


Hello

Why this command:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/rec/parport

is working when I type it in in command line
and not when I put it in file and run it?( There are no errors
when I run the file but I know that the command is not working).

Tried to add #!/bin/bash at the beginning without success.

Cheers
 
Old 03-17-2006, 02:49 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
If there are no errors, than how can you tell that the code isn't working?
The exported $LD_LIBRARY_PATH only applies to:
-programs started after the export command (in the script that contains the export command)
-programs started from scripts that "source" (ie include) the script that contains the export command.

Running for instance:
Code:
myscript.sh:

#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/rec/parport
as a separate script (ie calling "myscript.sh") will execute the export command. But since there are no other programs called after the export, it will have no effect.
Once the script stops, the changed $LD_LIBRARY_PATH variable is lost as well, since it was part of the script's environment, not the environment of the shell that calls the script.

If you want to have the changed LD_LIBRARY_PATH in the parent shell, you need to "source" script.sh rather than execute it.
This is done by:
Code:
. script.sh
After that, you'll see that your $LD_LIBRARY_PATH has changed.
 
Old 03-17-2006, 03:04 AM   #3
mac1234mac
Member
 
Registered: Sep 2005
Posts: 183

Original Poster
Rep: Reputation: 30
How can I know?. Because I can't run program in Java. Your solution is working.
Thanks.
 
  


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 to export $PATH so it stays put? Infernal211283 Linux - Newbie 3 01-22-2006 01:49 AM
export path command davidleroux1 Mandriva 8 01-19-2006 08:22 PM
export PATH Question Loosewheel Linux - Software 5 01-18-2006 01:44 PM
'export PATH' does not work lemuel Linux - Newbie 7 01-30-2005 11:39 AM
export PATH disappears twallstr Linux - General 4 12-13-2004 02:57 AM


All times are GMT -5. The time now is 01:55 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration