X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.profile.d%2FPATH.bashrc;h=66cd7090dfa7a948c07abca584b9aca5fd90dc14;hb=bcf2f3f85cd948a432f8f4d86b112c59b07dbd27;hp=1a271aa46a80c305e316d8f618312baa99059487;hpb=6b44a934006d39120df7760d7e55b6148a4e818a;p=profile.git diff --git a/.profile.d/PATH.bashrc b/.profile.d/PATH.bashrc index 1a271aa..66cd709 100644 --- a/.profile.d/PATH.bashrc +++ b/.profile.d/PATH.bashrc @@ -27,16 +27,24 @@ function makepath() { # Check the file exists. [ -e "$DIR/$dirs" ] || return + # Set IFS to newline only so that we can read $(embedded shell commands). + JGD=$IFS + IFS=' +' # 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. + IFS=$JGD + unset JGD + # Sanitise path. path=${path#:} [ -z "$path" ] && return