Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
share|improve this question

migrated from Sep 6 '10 at 18:02

This question came from our site for professional and enthusiast programmers.

-1 You mean what does this command do. Not what does this command line do. I almost thought the question was "What does the command line do"!! – barlop May 29 '11 at 18:36

In Bourne-like shells, it sets the variable ${LIBRARY_PATH} to be the current working directory (at the time at which it is referenced) and exports it for other commands to see.

If you wanted the current directory at the time of export, you would use:

export LIBRARY_PATH=$(pwd)

Note that this command disregards any contents which may have already been assigned to ${LIBRARY_PATH}. If you wish to append to ${LIBRARY_PATH} you could use:


GCC's linker is one such command that will consume ${LIBRARY_PATH}:

The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it can't find them using GCC_EXEC_PREFIX.

See man gcc and man export for more information.

share|improve this answer

This sets an environment variable LIBRARY_PATH to the current directoty in a shell script, and exports it so that other commands can see this value. This environment variable is checked by the linker to find all the libraries that your code references.

share|improve this answer
It sets the environment variable to a full-stop character. In the specific case of the way LIBRARY_PATH is used by compilers, this means the current directory at time of compilation. – Steve Jessop Sep 6 '10 at 12:45

this command tells the linker to search a library from the current directory.

share|improve this answer
No linker is mentioned in this command-line or the original question. The question seems far more straightforward than that. – Johnsyweb Sep 6 '10 at 23:45

This sets the environment variable LIBRARY_PATH. The value is the name of the current directrory. The export instructs the bash, that the variable will be not reside in the shell only but passed to commands started from here.

share|improve this answer
No, the value is the string ".". This represents the current directory when used as a filesystem path, but the shell does not substitute the name of the current directory in there. – Steve Jessop Sep 6 '10 at 12:43

You are setting the env variable LIBRARY_PATH to the current working directory and exporting it so that it is made available to programs outside the shell, compiler in your case.

This directories you specify in LIBRARY_PATH will be searched after any directories specified on the command line with the option -L, and before the standard default directories (such as /usr/local/lib and /usr/lib).

share|improve this answer
As I've said on the other answers - it sets LIBRARY_PATH to a value which means "the current directory" when the compiler uses it. It doesn't set it to the cwd at the time the export command is executed. – Steve Jessop Sep 6 '10 at 12:47

You must log in to answer this question.