Allow vim to be used by crontab -e.
[profile.git] / .profile.d / PATH.bashrc
index a7d4420..66cd709 100644 (file)
@@ -27,13 +27,23 @@ 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#:}
@@ -49,8 +59,8 @@ makepath PATH bindirs
 makepath C_INCLUDE_PATH incdirs
 copypath CPLUS_INCLUDE_PATH C_INCLUDE_PATH
 makepath LD_LIBRARY_PATH libdirs
-copypath LD_RUN_PATH LD_LIBRARY_PATH
+copypath LD_RUN_PATH PATH
 makepath MANPATH mandirs
 makepath PKG_CONFIG_PATH pkgdirs
 
-unset sedscr makepath copypath
+unset dirs copypath makepath newpath