Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


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

Rep: Reputation: 30
problems with export (path)


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.

Old 03-17-2006, 03:49 AM   #2
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:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/rec/parport
as a separate script (ie calling "") 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" rather than execute it.
This is done by:
After that, you'll see that your $LD_LIBRARY_PATH has changed.
Old 03-17-2006, 04:04 AM   #3
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.


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 02:49 AM
export path command davidleroux1 Mandriva 8 01-19-2006 09:22 PM
export PATH Question Loosewheel Linux - Software 5 01-18-2006 02:44 PM
'export PATH' does not work lemuel Linux - Newbie 7 01-30-2005 12:39 PM
export PATH disappears twallstr Linux - General 4 12-13-2004 03:57 AM > Forums > Linux Forums > Linux - Software

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration