You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
954B

  1. #
  2. # ~/.bashrc
  3. #
  4. # If not running interactively, don't do anything
  5. [[ $- != *i* ]] && return
  6. source $HOME/.profile 2>/dev/null
  7. export BASHRC_PROFILE_INDENT=
  8. for script in ~/.bashrc.d/*.sh; do
  9. if [ -x "$script" ]; then
  10. test -n "$BASHRC_DEBUG" && echo "Sourcing $script"
  11. if [ -n "$BASHRC_PROFILE" ]; then
  12. source <(
  13. sed \
  14. -e 's:function .*$:&\
  15. local profile_begin=`date +%s%N`\
  16. echo "$BASHRC_PROFILE_INDENT" "+" "${FUNCNAME[0]}" "$@" >>"$HOME/bashrc.perf"\
  17. BASHRC_PROFILE_INDENT+=" ":' \
  18. -e 's:^[[:space:]]*\(}\|return .*\)[[:space:]]*$:\
  19. local profile_end=`date +%s%N`\
  20. BASHRC_PROFILE_INDENT="${BASHRC_PROFILE_INDENT% }"\
  21. echo "$BASHRC_PROFILE_INDENT" "-" "`tput setaf 4`$((($profile_end - $profile_begin) / 1000000))ms`tput sgr0`" "${FUNCNAME[0]}" "$@" >>"$HOME/bashrc.perf"\
  22. &:' \
  23. "$script"
  24. )
  25. else
  26. source "$script"
  27. fi
  28. else
  29. test -n "$BASHRC_DEBUG" && echo "Skipping non-executable $script"
  30. fi
  31. done
  32. true