I'm experimenting with Linux shared libraries and added an entry (export LD_LIBRARY_PATH=/path/to/library:${LD_LIBRARY_PATH}
) to $LD_LIBRARY_PATH. Now I wish it gone. How can I do that?
PS. Typing echo $LD_LIBRARY_PATH
before I added an entry gave me an empty line. Now it says:
path/to/library:
The LD_LIBRARY_PATH environment variable tells Linux applications, such as the JVM, where to find shared libraries when they are located in a different directory from the directory that is specified in the header section of the program.
PATH is for specifying directories of executable programs. LD_LIBRARY_PATH is used to specify directories of libraries. From other point of view, PATH is used primarily by the shell, while LD_LIBRARY_PATH is used by the dynamic loader (usually ld-linux.so ).
LD_LIBRARY_PATH is an environmental variable used in Linux/UNIX Systems. It is used to tell dynamic link loaders where to look for shared libraries for specific applications. It is useful until you don't mess with it.
LD_LIBRARY_PATH - stands for LOAD LIBRARY PATH or some times called as LOADER LIBRARY PATH.
If previously it gave you empty line it (most probably) means that the variable was not set (by default it is not set), so you can just unset it:
unset LD_LIBRARY_PATH
A few other options to experiment:
export MY_PATH=/my/path
export MY_PATH2=/my/path2
export LD_LIBRARY_PATH="${MY_PATH}:${MY_PATH2}"
echo $LD_LIBRARY_PATH
/my/path:/my/path2
Removing path from the end:
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH/:${MY_PATH2}/}"
echo $LD_LIBRARY_PATH
/my/path
Similarily, removing path from the beginning (if set as above):
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH/${MY_PATH}:/}"
Assuming you're using bash
, you can set it back to an empty path using:
export LD_LIBRARY_PATH=""
And if you want to un-export it:
export -n LD_LIBRARY_PATH
The bash man page is a great piece of documentation to help out with this kind of problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With