Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: path/PATH function

On Nov 19, 10:37am, Sweth Chandramouli wrote:
} Subject: path/PATH function
} 	i long time ago, i wrote a quick function to take a list of
} space-delimited dirs, check to see if each one was currently in my path,
} and if  not, add it.
[describes cdpath mapping onto CDPATH]
} 	i'm assuming that this is some sort of zsh path-addition option, along 
} the lines of what i had created; i couldn't find any reference to it in the
} FAQ,  however, other than a note in the wish-list for users to "be able to
} create  their own foopath/FOOPATH array/path combinations."  does anyone
} know anything  more about this feature?

This "feature" is restricted at present to a few pairs of variables that are
hardwired at compile time.  They include:

CDPATH		cdpath
FPATH		fpath
MAILPATH	mailpath
MANPATH		manpath
PATH		path

These are documented in `man zshparam` and in the info files.  The remark
in the FAQ refers to the desire to provide arbitrary user-defined pairs
of variables that behave this way.

You might also wish to look into `typeset -U` which causes an array to
remove all non-unique elements from itself.  A function to test whether
any given directory is already in your path shouldn't be necessary.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Messages sorted by: Reverse Date, Date, Thread, Author