11#! /bin/bash
2- # ~/.bashrc: executed by bash(1) for non-login shells.
3- # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
4- # for examples
52
6- # If not running interactively, don't do anything
7- case $- in
8- * i* ) ;;
9- * ) return ;;
10- esac
11-
12- # check the window size after each command and, if necessary,
13- # update the values of LINES and COLUMNS.
14- shopt -s checkwinsize
15-
16- # If set, the pattern "**" used in a pathname expansion context will
17- # match all files and zero or more directories and subdirectories.
18- # shopt -s globstar
19-
20- # make less more friendly for non-text input files, see lesspipe(1)
21- [ -x /usr/bin/lesspipe ] && export LESSOPEN=" |lesspipe %s"
22-
23- # set variable identifying the chroot you work in (used in the prompt below)
24- if [ -z " ${debian_chroot:- } " ] && [ -r /etc/debian_chroot ]; then
25- debian_chroot=$( cat /etc/debian_chroot)
26- fi
27-
28- # set a fancy prompt (non-color, unless we know we "want" color)
29- case " $TERM " in
30- xterm-color) color_prompt=yes;;
31- esac
32-
33- # uncomment for a colored prompt, if the terminal has the capability; turned
34- # off by default to not distract the user: the focus in a terminal window
35- # should be on the output of commands, not on the prompt
36- force_color_prompt=yes
37-
38- if [ -n " $force_color_prompt " ]; then
39- if [ -x /usr/bin/tput ] && tput setaf 1 >& /dev/null; then
40- # We have color support; assume it's compliant with Ecma-48
41- # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
42- # a case would tend to support setf rather than setaf.)
43- color_prompt=yes
44- else
45- color_prompt=
46- fi
47- fi
48-
49- if [ " $color_prompt " = yes ]; then
50- PS1=' ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
51- else
52- PS1=' ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
53- fi
54- unset color_prompt force_color_prompt
55-
56- # If this is an xterm set the title to user@host:dir
57- case " $TERM " in
58- xterm* |rxvt* )
59- PS1=" \\ [\\ e]0;${debian_chroot: +($debian_chroot )} \\ u@\\ h: \\ w\\ a\\ ]$PS1 "
60- ;;
61- * )
62- ;;
63- esac
64-
65- # enable color support of ls and also add handy aliases
66- if [ -x /usr/bin/dircolors ]; then
67- # shellcheck disable=SC2015
68- test -r ~ /.dircolors && eval " $( dircolors -b ~ /.dircolors) " || eval " $( dircolors -b) "
69- alias ls=' ls --color=auto'
70- alias dir=' dir --color=auto'
71- alias vdir=' vdir --color=auto'
72-
73- alias grep=' grep --color=auto'
74- alias fgrep=' fgrep --color=auto'
75- alias egrep=' egrep --color=auto'
3+ # Source the bash prompt configuration
4+ if [[ -f " ${HOME} /.bash_prompt" ]]; then
5+ source " ${HOME} /.bash_prompt"
766fi
777
78- # Add an "alert" alias for long running commands. Use like so:
79- # sleep 10; alert
80- alias alert=' notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e ' \' ' s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//' \' ' )"'
81-
82- # enable programmable completion features (you don't need to enable
83- # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
84- # sources /etc/bash.bashrc).
85- if ! shopt -oq posix; then
86- if [[ -f /usr/share/bash-completion/bash_completion ]]; then
87- # shellcheck source=/dev/null
88- . /usr/share/bash-completion/bash_completion
89- elif [[ -f /etc/bash_completion ]]; then
90- # shellcheck source=/dev/null
91- . /etc/bash_completion
92- elif [[ -f /usr/local/etc/bash_completion ]]; then
93- # shellcheck source=/dev/null
94- . /usr/local/etc/bash_completion
95- fi
96- fi
97- if [[ -d /etc/bash_completion.d/ ]]; then
98- for file in /etc/bash_completion.d/* ; do
99- # shellcheck source=/dev/null
100- source " $file "
101- done
102- fi
103-
104- # We do this before the following so that all the paths work.
105- for file in ~ /.{bash_prompt,aliases,functions,path,exports}; do
106- if [[ -r " $file " ]] && [[ -f " $file " ]]; then
107- # shellcheck source=/dev/null
108- source " $file "
109- fi
8+ # Load other dotfiles if they exist
9+ for file in ~ /.{aliases,functions,path,dockerfunc,extra,exports}; do
10+ if [[ -r " $file " ]] && [[ -f " $file " ]]; then
11+ source " $file "
12+ fi
11013done
111- unset file
112-
113- # Case-insensitive globbing (used in pathname expansion)
114- shopt -s nocaseglob
115-
116- # Append to the Bash history file, rather than overwriting it
117- shopt -s histappend
118-
119- # Autocorrect typos in path names when using `cd`
120- shopt -s cdspell
121-
122- # Enable some Bash 4 features when possible:
123- # * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
124- # * Recursive globbing, e.g. `echo **/*.txt`
125- for option in autocd globstar; do
126- shopt -s " $option " 2> /dev/null
127- done
128-
129- # get the gh completions
130- if hash gh 2> /dev/null; then
131- eval " $( gh completion -s bash) "
132- fi
133-
134- GPG_TTY=$( tty)
135- export GPG_TTY
136- complete -W " \` grep -oE '^[a-zA-Z0-9_.-]+:([^=]|$)' ?akefile | sed 's/[^a-zA-Z0-9_.-]*$//'\` " make
14+ unset file
0 commit comments