Allow arbitrary shell expansion in *dirs.
[profile.git] / .profile.d / PATH.bashrc
index 1a271aa..4c5d535 100644 (file)
@@ -27,6 +27,10 @@ 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
@@ -37,6 +41,10 @@ function makepath() {
   done
   unset dir
 
+  # Restore IFS.
+  IFS=$JGD
+  unset JGD
+
   # Sanitise path.
   path=${path#:}
   [ -z "$path" ] && return