-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
executable file
·58 lines (50 loc) · 1.45 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
#!/bin/bash
# vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab:
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
function debug_echo() {
if [[ "$DEBUG" ]]; then
echo "$@"
fi
}
if [[ -x $(type -p tmux) && ! -v TMUX ]]; then
systemctl --user start tmux@main.service
exec tmux -S "${XDG_RUNTIME_DIR}/tmux-${UID}/main" new-session -A -s default
fi
declare -a _paths=''
for _path in "/usr/local/bin" "/usr/bin" "/usr/bin/core_perl" "$HOME/.local/bin"; do
test -d "$_path" && _paths+=("$_path")
done
unset PATH
for _path in "${_paths[@]}"; do
if test ! -v PATH; then
declare PATH="$_path"
elif test -z "$PATH"; then
PATH="$_path"
else
PATH="$PATH:$_path"
fi
done
export PATH
declare -a source_files_dirs=()
declare _dir=''
for _dir in "/etc/profile" "$HOME/.local/share/bash"; do
test -d "$_dir" && source_files_dirs+=( "$_dir" )
done
for source_file_dir in "${source_files_dirs[@]}"; do
if test -f "$source_file_dir"; then
debug_echo "Sourcing $source_file_dir"
# shellcheck source=/dev/null
. "$source_file_dir"
elif test -d "$source_file_dir"; then
pushd "$source_file_dir" &>/dev/null || exit 1
for file in *.sh; do
debug_echo "Sourcing ${source_file_dir}/$file"
# shellcheck source=/dev/null
. "$file"
done
popd &>/dev/null || exit 1
fi
done