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

Re: $PATH



On Jul 9, 10:28pm, Will Yardley wrote:
} Subject: $PATH
}
} noticed that if i do something like:
} PATH=$PATH:/dh/bin
} or whatever, each time i open a new shell (ie if i type 'zsh') my new shell
} has the arg appended twice
} 
} is there a simple solution i'm overlooking here?

Use the `path' array instead of the PATH scalar, and use `typeset -U'.

typeset -U path
path=($path /dh/bin)

Recent versions of zsh, e.g. 3.1.9/4.0.x, also allow `typeset -U' of a
colon-separated scalar like PATH, but the above will work in most 3.0.x
versions as well.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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