Paths

Different operating systems put tools in different places. Different releases of the same operating system put tools in different places. PATH.bashrc finds the directories which actually do contain the stuff you want and adds only those directories to your environment.

PATH.bashrc looks in $PROFILE_HOME/.PATH (or ~/.PATH if PROFILE_HOME is unset) for files containing lists of directories to search. Those directories which exist on the system will be added to the appropriate path in the environment:

Suppose for example that bindirs contains the following lines:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/X11R6/bin
/usr/sfw/bin
/opt/sfw/bin

On a Linux box your PATH would end up being /usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin while on an OpenSolaris box you would get /usr/bin:/bin:/usr/sbin:/sbin:/usr/sfw/bin:/opt/sfw/bin.

Variable expansion

Lines in XXXdirs files will be evaluated by the shell and may contain environment variables. Thus the following are valid inputs:

$PROFILE_HOME/opt/bin
/shared/$SYSTEM/$ARCHITECTURE/bin

PROFILE_HOME is treated specially. Any line containing PROFILE_HOME will first be parsed as-is, then parsed a second time with PROFILE_HOME replaced by HOME. This means that when you use the become command you may import directories in both your and the target user's home.

Prepending and appending

If you list some directories in bindirs then the PATH variable created by PATH.bashrc will replace any existing PATH you had. If you don't wish to wipe out whatever settings the OS provides but simply wish to add elements to the path you can list directories in bindirs.pre or bindirs.post. The same is true for the other XXXdirs files, of course.

Directories listed in bindirs.pre will be prepended to the path. Directories listed in bindirs.post will be appended to the path. If you have a bindirs.pre file but no bindirs file you can prepend elements to the PATH you inherit.

System-specific paths

XXXdirs (and their associated pre/post) files in $PROFILE_HOME/.PATH/$SYSTEM are given precedence over those described above. Files in $PROFILE_HOME/.PATH/$SYSTEM/$ARCHITECTURE are given the highest precedence.

Using OS defaults

If you do not create a .PATH directory then PATH.bashrc will make no changes to your environment and you will inherit whatever variables the OS provides for you when you log in.