-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
155 lines (118 loc) · 4.07 KB
/
bashrc
File metadata and controls
155 lines (118 loc) · 4.07 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# -*- sh -*-
# .bashrc
# ----------------------------------------------------------------------
# Basic bash preferences.
# If not running interactively, don't do anything.
[ -z "$PS1" ] && return
# Prompt. Emacs uses the "dumb" terminal type; don't try to use color sequences there.
if [ "$TERM" != "dumb" ]; then
export PS1='\[\e[1;33m\][\u@\h \W]\$\[\e[0m\] '
fi
# Don't put duplicate lines in the history.
export HISTCONTROL=ignoredups
# Check the window size after each command and update the values of
# LINES and COLUMNS if necessary.
shopt -s checkwinsize
# Append to .bash_history rather than overwriting.
shopt -s histappend
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# --------------------------------------------------------------------------------
# Bash history settings.
# Force unsaved history after each prompt.
export PROMPT_COMMAND='history -a'
# Log timestamps for each history entry.
export HISTTIMEFORMAT="%F %T | "
# ----------------------------------------------------------------------
# Basic UNIX setup.
# If available, make less more friendly for non-text input
# files. Ubuntu calls this 'lesspipe'. On Fedora, it's 'lesspipe.sh',
# but already enabled by default.
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# Debian/Ubuntu/Mint name ack as ack-grep.
alias ack=ack-grep
# --------------------------------------------------------------------------------
# Colors and prompts.
# Enable color support of ls where available.
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
fi
# If this shell is running in an xterm, set the title to
# user@host:dir.
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='history -a; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
PROMPT_COMMAND='history -a'
;;
esac
# Less options:
#
# -e: quit at EOF
# -r: raw control characters (makes git diff work)
# -X: disables sending termcap init/deinit strings
export LESS="-erX"
# Some Linuxes I use set SSH_ASKPASS=x11-ssh-askpass. No thanks.
unset SSH_ASKPASS
# ----------------------------------------------------------------------
# Simple shell functions.
# Sum a column of numbers.
function sumcol {
awk "{sum += \$$1} END {print sum}"
}
# ----------------------------------------------------------------------
# Editor setup.
export EDITOR="emacs -nw"
export SVN_EDITOR="emacs -nw"
# ----------------------------------------------------------------------
# Host specific setup.
if [ "$HOSTNAME" == "esclin3" ]; then
export ECN_CONNECT_UPSTREAM=1
export MQSERIES_HOME=/opt/mqm
export ECN_ENVIRONMENT=ecrampton_bzx
#export DISTCC_HOSTS="ltb7/4 ltb8/4 localhost/6"
#export PATH=/opt/distcc/masq:/opt/distcc/bin:$PATH
export USE_SCHEDULER=ltb7
export PATH=/opt/icecream/bin:/opt/distcc/bin:$PATH
export ECN_ROOT=/opt/ecn/users/$ECN_ENVIRONMENT
export ECN_USE_GET_PARAM=True
export LD_LIBRARY_PATH=$ECN_ROOT/bin:$MQSERIES_HOME/lib64:/opt/boost/lib:/opt/tsa/lib:$LD_LIBRARY_PATH
export COVFILE=$HOME/cpp/bats.cov
alias bsql='/home/ecrampton/scripts/bsql.sh'
fi
# ----------------------------------------------------------------------
# Local software setup which exists on some of my hosts.
function add_software {
ROOT=$HOME/software/$1
if [ -d "$ROOT" ]; then
if [ -d "$ROOT/bin" ]; then
export PATH=$PATH:$ROOT/bin
fi
if [ -d "$ROOT/share/man" ]; then
export MANPATH=$MANPATH:$ROOT/share/man
fi
if [ -d "$ROOT/lib" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOT/lib
fi
if [ -d "$ROOT/lib64" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOT/lib64
fi
fi
}
add_software bullseye
add_software git
add_software herbstluftwm
add_software tmux
add_software apache-maven
export M2_HOME=$HOME/software/apache-maven
if [ -h $HOME/software/jdk ]; then
export JAVA_HOME=$HOME/software/jdk
export PATH=$JAVA_HOME/bin:$PATH
elif [ -d /usr/java/latest ]; then
export JAVA_HOME=/usr/java/latest
export PATH=$JAVA_HOME/bin:$PATH
fi