git://git.iain.cx/iain
/
profile.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Highlight background of line numbers.
[profile.git]
/
.profile.d
/
PATH.bashrc
diff --git
a/.profile.d/PATH.bashrc
b/.profile.d/PATH.bashrc
index
20fbf9b
..
fa7fa01
100644
(file)
--- a/
.profile.d/PATH.bashrc
+++ b/
.profile.d/PATH.bashrc
@@
-1,5
+1,3
@@
-# $Id$
-#
# Path information is stored on separate lines in XXXdirs.
# We extract each directory exists and add it to the appropriate PATH.
#
# Path information is stored on separate lines in XXXdirs.
# We extract each directory exists and add it to the appropriate PATH.
#
@@
-27,15
+25,24
@@
function makepath() {
# Check the file exists.
[ -e "$DIR/$dirs" ] || return
# 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=
# Read them.
path=
- for dir in $(cat "$DIR/$dirs"); do
+ while read dir; do
+ dir=$(eval echo "$dir")
[ -d "$dir" ] || continue
path="$path:$dir"
[ -d "$dir" ] || continue
path="$path:$dir"
- done
+ done
< "$DIR/$dirs"
unset dir
unset dir
+ # Restore IFS.
+ IFS=$JGD
+ unset JGD
+
# Sanitise path.
path=${path#:}
[ -z "$path" ] && return
# Sanitise path.
path=${path#:}
[ -z "$path" ] && return
@@
-50,7
+57,7
@@
makepath PATH bindirs
makepath C_INCLUDE_PATH incdirs
copypath CPLUS_INCLUDE_PATH C_INCLUDE_PATH
makepath LD_LIBRARY_PATH libdirs
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
makepath MANPATH mandirs
makepath PKG_CONFIG_PATH pkgdirs