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

Re: Feature / Idea / (a possible option)



> We use a little Program called 'dotpath', to cleanup PATHes like
> 	export PATH=$(dotpath)
> where 'dotpath' prints the Path cleaned up from duplicate entries
> puts the '.' directory at the end (in case of 'root' accounts
> or 'wheel' group it even eliminates the '.').

How about typeset -U path PATH?  That makes the path unique.  Every
assignment after that will keep the path unique, so PATH=$PATH:$PATH
will leave the path unchanged.  To move the dot to the end, do

path=( "${path[@]:#.}" . )

To remove the dot, you can do:

path[(r).]=()

Zoli



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