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
Recovery plugin.
[profile.git]
/
.bash_profile
diff --git
a/.bash_profile
b/.bash_profile
index
49ea904
..
6fe0759
100644
(file)
--- a/
.bash_profile
+++ b/
.bash_profile
@@
-1,9
+1,14
@@
-if
tty -s || [
"${0:0:1}" = "-" -o "$1" = "force" ]; then
+if
[ -t 0 -o
"${0:0:1}" = "-" -o "$1" = "force" ]; then
# Remember if nocaseglob was on.
shopt -q nocaseglob
nocg=$?
# Turn it off so we source stuff in the right order.
shopt -u nocaseglob
# Remember if nocaseglob was on.
shopt -q nocaseglob
nocg=$?
# Turn it off so we source stuff in the right order.
shopt -u nocaseglob
+ # Remember if nullglob was on.
+ shopt -q nullglob
+ nullglob=$?
+ # Turn it on so we can look in subdirectories.
+ shopt -s nullglob
# Remember LC_ALL.
lc_all=$LC_ALL
# Remember LC_ALL.
lc_all=$LC_ALL
@@
-23,7
+28,7
@@
BECOME.bashrc"
profile_d=${PROFILE_HOME:-~}/.profile.d
deps=
unsorted=
profile_d=${PROFILE_HOME:-~}/.profile.d
deps=
unsorted=
- for i in $profile_d/*.bashrc; do
+ for i in $profile_d/
{*/,}
*.bashrc; do
dep=$(sed -n 's/^##*[ ]*profile-required:[ ]*//p' "$i")
i="${i##$profile_d/}"
if [ -n "$dep" ]; then
dep=$(sed -n 's/^##*[ ]*profile-required:[ ]*//p' "$i")
i="${i##$profile_d/}"
if [ -n "$dep" ]; then
@@
-46,7
+51,11
@@
$i"
${deps##*
}"
fi
${deps##*
}"
fi
- deps=$(echo "$deps" | tsort)
+ sorted=$(echo "$deps" | tsort)
+ if [ -n "$sorted" ]; then
+ deps="$sorted"
+ unset sorted
+ fi
deps="$required
$deps"
deps="$required
$deps"
@@
-56,20
+65,26
@@
$deps"
# Source them all in the right order.
sourced=
for i in $deps; do
# Source them all in the right order.
sourced=
for i in $deps; do
- [ -e "$profile_d/$i" ] || continue
- [ "${sourced/ $i /}" = "$sourced" ] || continue
- . "$profile_d/$i"
- sourced="$sourced $i "
+ for j in $profile_d/{,*/}$i; do
+ [ -e "$j" ] || continue
+ k="${j##$profile_d/}"
+ [ "${sourced/ $k /}" = "$sourced" ] || continue
+ . "$j"
+ sourced="$sourced $k "
+ break
+ done
done
# Maybe turn nocaseglob back on.
[ $nocg = 0 ] && shopt -s nocaseglob
done
# Maybe turn nocaseglob back on.
[ $nocg = 0 ] && shopt -s nocaseglob
+ # Maybe turn nullglob back off.
+ [ $nullglob = 0 ] || shopt -u nullglob
# Reset LC_ALL.
LC_ALL=$lc_all
# Reset LC_ALL.
LC_ALL=$lc_all
- unset i d n dep deps profile_d path required unsorted sourced
- unset lc_all nocg
+ unset i
j k
d n dep deps profile_d path required unsorted sourced
+ unset lc_all n
ullglob n
ocg
# Don't inherit failure from the last script.
true
# Don't inherit failure from the last script.
true