summaryrefslogtreecommitdiff
path: root/.zsh/utils
diff options
context:
space:
mode:
Diffstat (limited to '.zsh/utils')
-rw-r--r--.zsh/utils24
1 files changed, 24 insertions, 0 deletions
diff --git a/.zsh/utils b/.zsh/utils
index fd81acd..1097637 100644
--- a/.zsh/utils
+++ b/.zsh/utils
@@ -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