-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot-bash_profile
39 lines (37 loc) · 1.07 KB
/
dot-bash_profile
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
# shellcheck shell=bash
# From man 1 bash:
# When bash is invoked as an interactive login shell, or as a non-interactive
# shell with the --login option, it first reads and executes commands from the
# file /etc/profile, if that file exists. After reading that file, it looks
# for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads
# and executes commands from the first one that exists and is readable.
# PATH
POTENTIAL_PATHS=(
~/.krew/bin
~/.local/bin
~/bin
~/.cargo/bin
~/.pulumi/bin/
~linuxbrew/.linuxbrew/bin/
/snap/bin
/usr/local/go/bin
/cygdrive/c/Go/bin
/usr/local/bin
/usr/local/sbin
/usr/bin
/usr/sbin
/bin
/sbin
/usr/games
/cygdrive/c/Program Files/Git/cmd
)
VALID_PATHS=
# Only add a path to PATH if it it exists and isn't already in PATH. VALID_PATHS is used as intermediary variable
for p in "${POTENTIAL_PATHS[@]}"; do
if [[ -d "${p}" ]]; then
if [[ ":${VALID_PATHS}:" != *":${p}:"* ]]; then
VALID_PATHS="${VALID_PATHS:+"${VALID_PATHS}:"}${p}"
fi
fi
done
export PATH="${VALID_PATHS}"