about summary refs log tree commit diff stats
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_logout6
-rw-r--r--bash/bash_profile4
-rw-r--r--bash/bashrc41
3 files changed, 51 insertions, 0 deletions
diff --git a/bash/bash_logout b/bash/bash_logout new file mode 100644 index 0000000..d6c9b7a --- /dev/null +++ b/bash/bash_logout
@@ -0,0 +1,6 @@
1# bash_logout
2# vim:ft=sh
3
4if [[ -r "$XDG_CONFIG_HOME"/bash/logout ]]; then
5 source "$XDG_CONFIG_HOME"/bash/logout
6fi
diff --git a/bash/bash_profile b/bash/bash_profile new file mode 100644 index 0000000..4439ca7 --- /dev/null +++ b/bash/bash_profile
@@ -0,0 +1,4 @@
1# bash_profile
2
3[[ -f ~/.profile ]] && source ~/.profile
4[[ -f ~/.bashrc ]] && source ~/.bashrc
diff --git a/bash/bashrc b/bash/bashrc new file mode 100644 index 0000000..4966e75 --- /dev/null +++ b/bash/bashrc
@@ -0,0 +1,41 @@
1# bashrc
2
3# If not running interactively, don't do anything
4[[ $- != *i* ]] && return
5
6BASH_SOURCE_FIRST=(
7 aliases
8 functions
9)
10
11BASH_SOURCE_LAST=(
12 blesh
13)
14
15for f in "${BASH_SOURCE_FIRST[@]}"; do
16 file="${XDG_CONFIG_HOME:-$HOME/.config}/bash/$f.bash"
17 [[ -r "$file" ]] && source "$file" # || echo >&2 "no '$file' found"
18done
19
20for file in "$XDG_CONFIG_HOME"/bash/*.bash; do
21 file_base="${file##*/}"
22 memq "${file_base%.bash}" "${BASH_SOURCE_FIRST[@]}" && {
23 # echo >&2 "'$file' in BASH_SOURCE_FIRST, skipping"
24 continue
25 }
26 memq "${file_base%.bash}" "${BASH_SOURCE_LAST[@]}" && {
27 # echo >&2 "'$file' in BASH_SOURCE_LAST, skipping"
28 continue
29 }
30 [[ -r "$file" ]] && {
31 # echo >&2 "Sourcing '$file'"
32 source "$file"
33 }
34 unset file_base
35done
36
37for f in "${BASH_SOURCE_LAST[@]}"; do
38 file="${XDG_CONFIG_HOME:-$HOME/.config}/bash/$f.bash"
39 [[ -r "$file" ]] && source "$file" # || echo >&2 "no '$file' found"
40 true
41done