-
Notifications
You must be signed in to change notification settings - Fork 2
/
.bashrc
39 lines (37 loc) · 1.38 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if [ -d $HOME/.bashrc.d ]
then
[ -n "${DEBUG:-}" ] && start_time0=$(date +%s.%3N)
for bashrc in $HOME/.bashrc.d/*.bash; do
[ -n "${DEBUG:-}" ] && start_time=$(date +%s.%3N)
source $bashrc
if [ -n "${DEBUG:-}" ]
then
end_time=$(date +%s.%3N)
# elapsed time with millisecond resolution
# keep three digits after floating point.
elapsed=$(echo "scale=3; $end_time - $start_time" | bc)
echo "*** took $elapsed seconds to source $bashrc"
fi
done
if [ -n "${DEBUG:-}" ]
then
end_time0=$(date +%s.%3N)
# elapsed time with millisecond resolution
# keep three digits after floating point.
elapsed0=$(echo "scale=3; $end_time0 - $start_time0" | bc)
echo "=== took $elapsed0 seconds to source all"
fi
if [ -n "${DEBUG:-}" ]
then
unset start_time
unset end_time
unset elapsed
fi
fi
### DEBUG INFO
# PS4='+$BASH_SOURCE> ' BASH_XTRACEFD=7 bash -xl 7>&2
## That will simulate a login shell and show everything that is done along
# with the name of the file currently being interpreted.
# So all you need to do is look for the name of your environment variable in
# that output. (you can use the script command to help you store the whole
# shell session output, or for the bash approach, use 7> file.log instead ofbashrc