X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/4983780af98c0465162b06554cd55ffcd213cfcd..c035e794d622d7074c8fa94e18cb5ddfea7c36a1:/dot/bash_profile diff --git a/dot/bash_profile b/dot/bash_profile index a6015e9..513f754 100644 --- a/dot/bash_profile +++ b/dot/bash_profile @@ -19,7 +19,7 @@ cd $HOME # --- Add elements to a path string --- __mdw_addto () { - local var=$1 val dir=$2 new="" + local var=$1 val dir=$2 new="" change=nil eval "val=\$$var" shift 2 for i in "$@"; do @@ -27,7 +27,7 @@ __mdw_addto () { [ -d $i ] || continue case "X$val" in X) - val=$i + val=$i change=t continue ;; X$i) @@ -43,13 +43,13 @@ __mdw_addto () { val=${val%:$i} ;; esac - new=$new:$i + new=$new:$i change=t done case $dir in l) val=${new#:}:$val;; r) val=$val$new;; esac - export $var=$val + case $change in t) export $var="$val" ;; esac } # --- Set the path variable ---