-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.profile
More file actions
58 lines (50 loc) · 1.52 KB
/
.profile
File metadata and controls
58 lines (50 loc) · 1.52 KB
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
# .profile is sourced by interactive login shells only
#
# This file will be sourced by sh(1) or other shells on a rare occassion so
# avoid modern things like `[[`. Switch to .bash_profile otherwise.
# Default user=rwX group=rX other=rX for file creation
umask 0022
err() {
printf "\033[1;31m%s\033[0m\n" "$*" >&2
}
# Local bin dir (and try to only add it once)
add_path() {
local p
for p in "$@"; do
case ":$PATH:" in
*:"$p":*) ;;
*) PATH="${p}${PATH:+:$PATH}" ;;
esac
done
export PATH
}
add_path "$HOME/.config/bin" "$HOME/.local/bin"
# logind doesn't seem to set this (I think it sets the other XDG vars)
[[ "$XDG_CONFIG_HOME" ]] || export XDG_CONFIG_HOME="$HOME/.config"
# locale/LANG
if [[ ! "$LANG" ]]; then
if command -v locale &> /dev/null; then
if locale -a | grep -qi en_US.utf8; then
export LANG=en_US.UTF-8
else
export LANG=C.UTF-8
fi
fi
fi
export LC_COLLATE=C.UTF-8
# SSH/GPG Agent
if [[ -z "$SSH_AUTH_SOCK" ]]; then
if systemctl --user is-active --quiet gpg-agent-ssh.socket; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
unset SSH_AGENT_PID
fi
fi
# Allow profile snippets. I'm hot-and-cold on whether this is cleaner or not.
# At least two good usecases are 1) large/messy snippets, 2) scratch or local
# snippets that I don't want to track with dotfiles.git
for f in "$HOME"/.config/profile.d/*.sh; do
[[ -r "$f" ]] && source "$f"
done
unset f
# We still want bashrc for non-login shells, bash doesn't source it for us.
[[ -r "$HOME"/.bashrc ]] && source "$HOME"/.bashrc