ADDPATH(1)

NAME
addpath - add items to your $PATH, avoiding duplication

SYNOPSIS
addpath [-abrVh] [-P path] dir [...]
addpath {--after,--before,--reorder,--version,--help} {--path PATH} dir [...]

DESCRIPTION
Addpath adds directories to your PATH environment variable, avoiding duplication. This command is meant for use in shell scripts, where you may want to modify a path but want to avoid having commonly used paths duplicated. Addpath can not actually modify the shell PATH, so it simply echos the new path to stdout. To add /home/orc/bin:/usr/games to your path, you would do the command PATH=`addpath /home/orc/bin:/usr/games` (If you're using the csh, you would do setenv path (`addpath /home/orc/bin:/usr/games`)

Addpath normally adds new directories to the end of the path, avoiding duplicates, but you may change some of the behavior with the following options.

-b , --before
    Add new directories before the existing path.

-a , --after
    Add new directories after the existing path (this is the default.)

-r , --reorder
    Reorders the existing path. If new directories are already in the path, they will be pulled out and added with the rest of the new directories.

-P , --path
    Use the given path instead of PATH.

-V , --version
    Prints the source code control version string for addpath , then quits.

-h, --help
    Prints a short help message for addpath , then quits.

EXAMPLES

To add /tools/bin to the start of your path
    PATH=`addpath --before /tools/bin`

To make sure that /tools/bin is at the start of your path
    PATH=`addpath --reorder --before /tools/bin`

AUTHOR
David Parsons ( orc@pell.chi.il.us )

BUGS
If something horrible goes wrong and addpath fails, your path will be garbaged. When addpath runs out of memory it prints the current path before dying, but if you can't find the executable or if someone kills it, your path will be scrambled.