commit 8114d341e9726021c877ffc9185b733ff12b0669
parent ddb5a0bd4394919e6f7309ba4d267d8f61dfc6cb
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 28 Mar 2017 17:48:40 -0700
Fix function comments in .paths
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.paths b/.paths
@@ -1,11 +1,12 @@
# -*- mode: shell-script; -*- vim: set filetype=sh
# ~/.paths
-# add to path if not already there
+# Cleanly remove $1 from $PATH
path_remove() {
PATH=$(echo $PATH | sed "s:^$1\:::;s:\:$1\::\::;s:\:$1::")
}
+# Move/add $1 to the start of $PATH
path_prepend() {
path_remove "$1"
if [ -d "$1" ]; then
@@ -13,6 +14,7 @@ path_prepend() {
fi
}
+# Move/add $1 to the end of $PATH
path_append() {
path_remove "$1"
if [ -d "$1" ]; then