X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.profile.d%2FPATH.bashrc;h=3113f75a54ddec55d0fff56c08de953c377c5ee8;hb=0d7023a2b67fadc9eb2805681c09b1eb7ea3f7a7;hp=4c5d535330a150da2a4bd0b54ebf05ba2e134c6b;hpb=8c1da009c60a70fc256405ca5d9d044ac694a2ad;p=profile.git diff --git a/.profile.d/PATH.bashrc b/.profile.d/PATH.bashrc index 4c5d535..3113f75 100644 --- a/.profile.d/PATH.bashrc +++ b/.profile.d/PATH.bashrc @@ -1,11 +1,9 @@ -# $Id$ -# # Path information is stored on separate lines in XXXdirs. # We extract each directory exists and add it to the appropriate PATH. # # Location of the XXXdirs files. -DIR=$HOME/.profile.d +DIR="$HOME/.profile.d" # Set one path to be the same as another. function copypath() { @@ -14,7 +12,7 @@ function copypath() { # Sanitise and export. path="$(eval echo \$$oldpath)" - [ -z "$path" ] || eval export $newpath="$path" + [ -z "$path" ] || eval "export $newpath='$path'" unset path newpath oldpath } @@ -33,12 +31,12 @@ function makepath() { ' # Read them. path= - for dir in $(cat "$DIR/$dirs"); do + while read dir; do dir=$(eval echo "$dir") [ -d "$dir" ] || continue path="$path:$dir" - done + done < "$DIR/$dirs" unset dir # Restore IFS. @@ -50,7 +48,7 @@ function makepath() { [ -z "$path" ] && return # Export. - eval export $newpath="$path" + eval "export $newpath='$path'" unset path newpath dirs }