-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_bashrc
More file actions
89 lines (72 loc) · 2.51 KB
/
dot_bashrc
File metadata and controls
89 lines (72 loc) · 2.51 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
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
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Put your fun stuff here.
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
HISTTIMEFORMAT="%H:%M:%S "
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
function python_ver()
{
if [ -z "${EPYTHON}" ]
then
[ -z "${PTN_VER}" ] && PTN_VER="$($(which python) --version | cut -d' ' -f2)"
else
PTN_VER="$(echo ${EPYTHON} | sed -e 's!python!!')"
fi
echo ${PTN_VER}
}
function git_branch()
{
GIT_BRANCH_BS="$(git status -bs 2>/dev/null | grep '\#\#')"
GIT_BRANCH_LOCAL="$(echo $GIT_BRANCH_BS | awk '{match($2,"^(.*)[.]{3,3}",a); if (RLENGTH != -1) { print a[1]; } else { print $2; }; }')"
if [ -z "$(echo ${GIT_BRANCH_LOCAL} | grep '/')" ]
then
GIT_BRANCH="${GIT_BRANCH_LOCAL}"
else
GIT_BRANCH="$(echo ${GIT_BRANCH_LOCAL} | awk '{match($1, "^[a-z]+/([^_]{1,10}).*",a); print a[1]; }')"
fi
if [[ -z "${GIT_BRANCH}" || "\n" = "${GIT_BRANCH}" ]]
then
GIT_BRANCH="none"
fi
echo $GIT_BRANCH
}
function local_get_prompt()
{
PS1='[\t] \[\033[01;38m\][python $(python_ver)] [br $(git_branch)]\[\033[00m\] \[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;34m\]\w\[\033[00m\]\$ '
}
PS1='[\t] \[\033[01;38m\][python $(python_ver)]\[\033[00m\] \[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;34m\]\w\[\033[00m\]\$ '
PROMPT_COMMAND=local_get_prompt
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Predictable SSH authentication socket location.
SOCK="/tmp/ssh-agent-$USER-screen"
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $SOCK ]
then
rm -f /tmp/ssh-agent-$USER-screen
ln -sf $SSH_AUTH_SOCK $SOCK
export SSH_AUTH_SOCK=$SOCK
fi
export EDITOR=/usr/bin/vim
export TZ="Europe/Stockholm"
#xhost si:localuser:ff