-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_profile
55 lines (44 loc) · 1.59 KB
/
.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## .bash_profile
# Run for interactive Bash login shells
# Source global definitions
if [ -f /lab/DefaultSetups/bash_profile ]; then
. /lab/DefaultSetups/bash_profile
fi
# Set umask for more privacy. Child processes inherit the umask from
# parent processes, so it is correct to put this in the profile, not
# the rc. See <http://en.wikipedia.org/wiki/Umask#Processes>.
umask 0077 ## umask u=rwx,g=,o=
# Export virgin state of $PATH
export PATH_PREV=$PATH
# Prepend a path to a variable if the path exists.
# $1: the path variable name
# $2: the path to check and possibly prepend
path_prepend () {
[[ -d "$2" ]] && eval "$1="'"$2:${!1}"'
}
# Add hierarchy directories to paths. Manually-installed programs
# (~/.local) should override Linuxbrew programs (~/.linuxbrew).
#
# Inspired by
# <https://technotales.wordpress.com/2010/09/19/managing-path-and-manpath/>
for prefix in ~/.linuxbrew ~/.local; do
path_prepend PATH "$prefix/bin"
path_prepend MANPATH "$prefix/share/man" # usual manpage install directory
path_prepend MANPATH "$prefix/man" # older manpage install directory
path_prepend INFOPATH "$prefix/share/info"
done
# Personal scripts directory
path_prepend PATH ~/bin
# Unset definition of path_prepend
unset -f path_prepend
# Export path variables
export PATH MANPATH INFOPATH
# Set the editor to use when a program needs to edit a file
export EDITOR='vim'
# Bash doesn't run the .bashrc for login shells -- only .bash_profile.
# However, we want to run everything in the .bashrc as well.
#source ~/.bashrc
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi