From: Iain Patterson Date: Fri, 20 Jun 2014 09:34:38 +0000 (+0100) Subject: Save path to .profile.d in PROFILE_D variable. X-Git-Url: http://git.iain.cx/?p=profile.git;a=commitdiff_plain;h=2fe3b0c0e43ecc6381b4ed6a05cfa50493d67b56;hp=aa5af0db612809f689ffcb16ef3d3e6cc419c69f Save path to .profile.d in PROFILE_D variable. Make PROFILE_D similar to PROFILE_HOME with the differences that it is unconditionally set (PROFILE_HOME is unset if it is the same as HOME) and never exported (PROFILE_HOME is exported under become). --- diff --git a/.bash_profile b/.bash_profile index 3d5d075..6a1eaf8 100644 --- a/.bash_profile +++ b/.bash_profile @@ -34,12 +34,12 @@ BECOME.bashrc" PATH=/usr/bin:/bin:/usr/ccs/bin # Sort all scripts by dependencies. - profile_d=${PROFILE_HOME:-~}/.profile.d + 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/}" + i="${i##$PROFILE_D/}" if [ -n "$dep" ]; then for d in $dep; do deps="$deps @@ -74,9 +74,9 @@ $deps" # Source them all in the right order. sourced= for i in $deps; do - for j in $profile_d/{,*/}$i; do + for j in $PROFILE_D/{,*/}$i; do [ -e "$j" ] || continue - k="${j##$profile_d/}" + k="${j##$PROFILE_D/}" [ "${sourced/ $k /}" = "$sourced" ] || continue . "$j" sourced="$sourced $k " @@ -92,7 +92,7 @@ $deps" # Reset LC_ALL. LC_ALL=$lc_all - unset i j k d n dep deps profile_d path required unsorted sourced + unset i j k d n dep deps path required unsorted sourced unset lc_all nullglob nocg # Don't inherit failure from the last script.