forked from MikeMcQuaid/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 6
/
shprofile.sh
52 lines (44 loc) · 1.31 KB
/
shprofile.sh
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
# 077 would be more secure, but 022 is more useful.
umask 022
# Save more history
export HISTSIZE=100000
export SAVEHIST=100000
# OS variables
[ "$(uname -s)" = "Darwin" ] && export OSX=1 && export UNIX=1
[ "$(uname -s)" = "Linux" ] && export LINUX=1 && export UNIX=1
uname -s | grep -q "_NT-" && export WINDOWS=1
grep -q "Microsoft" /proc/version 2>/dev/null && export UBUNTU_ON_WINDOWS=1
# Fix systems missing $USER
[ -z "$USER" ] && export USER="$(whoami)"
# Count CPUs for Make jobs
if [ $OSX ]
then
export CPUCOUNT=$(sysctl -n hw.ncpu)
elif [ $LINUX ]
then
export CPUCOUNT=$(getconf _NPROCESSORS_ONLN)
else
export CPUCOUNT="1"
fi
if [ "$CPUCOUNT" -gt 1 ]
then
export MAKEFLAGS="-j$CPUCOUNT"
export BUNDLE_JOBS="$CPUCOUNT"
fi
# Enable Terminal.app folder icons
[ "$TERM_PROGRAM" = "Apple_Terminal" ] && export TERMINALAPP=1
if [ $TERMINALAPP ]
then
set_terminal_app_pwd() {
# Tell Terminal.app about each directory change.
printf '\e]7;%s\a' "$(echo "file://$HOST$PWD" | sed -e 's/ /%20/g')"
}
fi
[ -s ~/.lastpwd ] && [ "$PWD" = "$HOME" ] && \
builtin cd "$(cat ~/.lastpwd)" 2>/dev/null
[ $TERMINALAPP ] && set_terminal_app_pwd
# Load secrets
[ -f "$HOME/.secrets" ] && source "$HOME/.secrets"
# Some post-secret aliases
export OCTOKIT_ACCESS_TOKEN="$GITHUB_TOKEN"
export HUBOT_GITHUB_TOKEN="$GITHUB_TOKEN"