-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
100 lines (81 loc) · 2.62 KB
/
bashrc
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
elif [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
# Enable tab completion in shell
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# File-creation mode mask. No core dumps.
umask 007
ulimit -c 0
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# don't put duplicate lines or those starting with a space in the history
# and erase previously saved lines matching the current line
HISTCONTROL=ignoreboth:erasedups
# Mark the history with timestamps
HISTTIMEFORMAT="%F %T %Z | "
# Number of history lines saved (default 500)
HISTSIZE=1000
# set the default editor
export EDITOR=vim
# Uncomment the following line if you don't like systemctl's auto-paging feature:
export SYSTEMD_PAGER=
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# options for less
LESS=-rFx4
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# Define some colors to use
BOLD="\033[1m"
NORM="\033[0m"
# A more elaborate prompt deserves its own file, otherwise a simple prompt will do
if [ -f ~/.bash_prompt ]; then
. ~/.bash_prompt
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS2=':-( '
fi
# enable color support of the bourne shell
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
fi
# Alias definitions are done in a separate file
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Search for an existing ssh agent, connect to the first one we find
__get_agent_pid() {
pgrep --full --uid ${USER} "/tmp/ssh-${USER}/agent"
}
#__get_agent_socket() {
# find ~/.ssh/ -type s -user ${USER} -name "agent" 2> /dev/null
#}
if [[ $(__get_agent_pid) -gt 1 ]] &&\
[[ $(__get_agent_pid) -le $(< /proc/sys/kernel/pid_max) ]] &&\
[[ -S "/tmp/ssh-${USER}/agent" ]]; then
export SSH_AGENT_PID=$(__get_agent_pid)
export SSH_AUTH_SOCK="/tmp/ssh-${USER}/agent"
echo -e "${BOLD}Agent pid ${SSH_AGENT_PID} (reconnected)${NORM}"
else
mkdir -m 0700 -p "/tmp/ssh-${USER}"
echo -ne "${BOLD}"
eval $(ssh-agent -a "/tmp/ssh-${USER}/agent" -s)
echo -ne "${NORM}"
fi
# set proxy if necessary
if [ -f ~/.proxy ]; then
. ~/.proxy
fi