diff options
Diffstat (limited to '.zsh/utils')
-rw-r--r-- | .zsh/utils | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -7,6 +7,30 @@ # # Source repository: git://git.distanz.ch/dotfiles/zsh.git +# prepend custom directory to $PATH +path_prepend() +{ + local dir + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path=("$dir" $path);; + esac + done +} + +# append custom directory to $PATH +path_append() +{ + local dir + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path+="$dir";; + esac + done +} + # are we root? is_root() { test ${EUID:?} -eq 0 |