From b3abab8e9a298891172dc896672efe857410ae98 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Tue, 22 Jun 2010 14:45:42 +0100 Subject: [PATCH] Process dependencies in subdirectories. This allows having, for example, a symlink to standard bashrc files and local overrides. --- .bash_profile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.bash_profile b/.bash_profile index 56a1eb0..a89f59e 100644 --- a/.bash_profile +++ b/.bash_profile @@ -65,10 +65,14 @@ $deps" # 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. @@ -79,7 +83,7 @@ $deps" # Reset LC_ALL. LC_ALL=$lc_all - unset i d n dep deps profile_d path required unsorted sourced + unset i j k d n dep deps profile_d path required unsorted sourced unset lc_all nullglob nocg # Don't inherit failure from the last script. -- 2.7.4