-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
69 lines (50 loc) · 1.35 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Startup file for Bash interactive shells
##
## Fail-safe against non-interactive shells
##
# Rely on $PS1 to be empty in a non-interactive shell
[ -n "$PS1" ] || return
##
## Disable keyboard input while runcoms are loaded
##
stty -icanon -echo
##
## Set and export the name of the current shell
##
export D__SHELL=bash
##
## Source the box-specific '.pre.*sh' files
##
[ -f ~/.pre.bash -a -r ~/.pre.bash ] && source ~/.pre.bash
[ -f ~/.pre.sh -a -r ~/.pre.sh ] && source ~/.pre.sh
##
## Source all *.bash and *.sh files in ~/.runcoms dir, sorted
#. alphanumerically
##
# Save current state of 'dotglob' and 'nullglob' options
restore_opts=("$(shopt -p dotglob)" "$(shopt -p nullglob)")
# Set both 'dotglob' and 'nullglob' options
shopt -s dotglob nullglob
## Globbing sorts entries alphanumerically; so the files are sourced in the
#. order of their names.
#
for script_path in ~/.config/shell/*; do case $script_path in
*.bash | *.sh) source "$script_path" ;;
esac done
unset script_path
# Restore state of 'dotglob' and 'nullglob' options
for cmd in "${restore_opts[@]}"; do $cmd; done
unset cmd restore_opts
##
## Source the box-specific '.post.*sh' files
##
[ -f ~/.post.bash -a -r ~/.post.bash ] && source ~/.post.bash
[ -f ~/.post.sh -a -r ~/.post.sh ] && source ~/.post.sh
##
## Re-enable keyboard input
##
stty icanon echo
##
## Graceful exit
##
true