X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/66e0c46c40148f44edc4a1ddfd1c63b4e577ab3f..a2a79686218f805dd5a7cfbda210a517fe5c4934:/.zsh/zprofile/00_path diff --git a/.zsh/zprofile/00_path b/.zsh/zprofile/00_path index bac01d4..230e94f 100644 --- a/.zsh/zprofile/00_path +++ b/.zsh/zprofile/00_path @@ -8,18 +8,27 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -for p in $HOME/bin $HOME/.bin; do - case "$PATH" in - "*:${p}:*"|"${p}:*"|"*:${p}") :;; - *) PATH="${p}:$PATH";; - esac -done +__prepend_dir_to_path() +{ + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path=("$dir" $path);; + esac + done +} -for p in /usr/lib/surfraw; do - case "$PATH" in - "*:${p}:*"|"${p}:*"|"*:${p}") :;; - *) PATH="${PATH}:$p";; - esac -done +__append_dir_to_path() +{ + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path+="$dir";; + esac + done +} + +__prepend_dir_to_path $BINDIR +__append_dir_to_path /usr/lib/surfraw # vim:ft=zsh