-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc_user
69 lines (57 loc) · 2.12 KB
/
bashrc_user
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
59
60
61
62
63
64
65
66
67
68
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
export SET_IN_HOME_BASHRC_USER=yes
# find directory of this script
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
# Env definitions.
# include .bash_env if it exists
if [ -f "$HOME/.bash_env" ]; then
. "$HOME/.bash_env"
fi
# set PATH so it includes user's private bin directories
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
fi
# inlucde MacPorts bin path (if they exist)
if [ -d "/opt/local/bin" ] ; then
PATH="/opt/local/bin:/opt/local/sbin:$PATH"
fi
# make a nice prompt when in git repos
# stuff for the git-prompt, check
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# for details
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
source ${DIR}/bin/git-prompt.sh
# color hostname in red if not on localhost
# cs005046
if [[ $(hostname) = "cs005046" ]]; then
# 90 is dark grey, they least annoying
HOSTCOLOR="\e[0;90m"
else
HOSTCOLOR="\e[0;31m"
fi
RESETCOLOR="\e[m"
if [ "$TERM" != "linux" ]; then
PROMPT_COMMAND='__git_ps1 "\u@\[${HOSTCOLOR}\]\h\[${RESETCOLOR}\]:" "\\\$ "'
fi
# Set Window Title to Hostalias / Hostname
TITLE="${HOSTALIAS:-$HOSTNAME}"
echo -en "\e]0;Host: $USER@$TITLE\a"
# install bash-completion for gopass if gopass
# is installed
command -v gopass >/dev/null 2>&1 && source <(gopass completion bash)