-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.bashrc
52 lines (42 loc) · 1020 Bytes
/
.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
# system default ~/.bashrc
if [ -f "$HOME/.bashrc_default" ]; then
source "$HOME/.bashrc_default"
fi
function __remove_path {
PATH=$(echo $PATH | tr : '\n' | grep -v -e "^$1\$" | xargs echo | tr ' ' :)
}
function __prepend_path {
__remove_path "$1"
if [ -d "$1" ]; then
PATH="$1:$PATH"
fi
}
function __append_path {
__remove_path "$1"
if [ -d "$1" ]; then
PATH="$PATH:$1"
fi
}
# local installations
__prepend_path "$HOME/local/bin"
__prepend_path "$HOME/.local/bin"
# Rust/Cargo
__prepend_path "$HOME/.cargo/bin"
# asdf
if [ -f "$HOME/.asdf/asdf.sh" ]; then
source "$HOME/.asdf/asdf.sh"
fi
# cross-compilers
if [ -d $HOME/x-tools ]; then
for dir in $(find $HOME/x-tools/ -mindepth 2 -maxdepth 2 -type d -name bin); do
__append_path "$dir"
done
fi
# custom scripts
__prepend_path "$HOME/bin"
# help Cargo find SSL certs on NetBSD
if [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then
export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
fi
export PATH
export BASHRC=true