[Previous] [Contents] [Next]

Setting the PATH Environment Variable

This technote explains how two path-setting environment variables are specified in QNX 6.

The environment variable PATH specifies the search paths for commands. The environment variable LD_LIBRARY_PATH specifies the search paths for shared libraries for a native linker.

The initial default values of PATH and LD_LIBRARY_PATH are specified in the buildfile before procnto is started. Two configuration strings, _CS_PATH and _CS_LIBPATH respectively take the default values of PATH and LD_LIBRARY_PATH. The login utility uses _CS_PATH to set the value of PATH and passes this environment variable and both configuration strings to its child processes.

If you type set or env in a shell that was started from login, you will see the PATH variable, but not LD_LIBRARY_PATH; _CS_LIBPATH works in the same manner as LD_LIBRARY_PATH.

The file /etc/default/login preserves environment variables that would otherwise be destroyed in the login process. You can edit this file to add new variables, such as LD_LIBRARY_PATH, but you can't change existing variables such as PATH and TERM.

If you use ksh as your login shell, you can edit /etc/profile and $HOME/.profile to override existing variables and add new ones. Any environment variables set in /etc/profile override previous settings in /etc/default/login; $HOME/.profile overrides both /etc/default/login and /etc/profile.

For more information on configuration strings, see confstr in the Library Reference and getconf in the Utilities Reference.


[Previous] [Contents] [Next]