-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc.symlink
167 lines (149 loc) · 4.94 KB
/
bashrc.symlink
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
156
157
158
159
160
161
162
163
164
165
166
167
# /etc/bashrc -- Stolen from a Fedora install, then appended a few things.
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# It's NOT good idea to change this file unless you know what you
# are doing. Much better way is to create custom.sh shell script in
# /etc/profile.d/ to make custom changes to environment. This will
# prevent need for merging in future updates.
# By default, we want this to get set.
# Even for non-interactive, non-login shells.
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
# If you want to do so, just add e.g.
# if [ "$PS1" ]; then
# PS1="[\u@\h:\l \W]\\$ "
# fi
# to your custom modification shell script in /etc/profile.d/ directory
fi
if ! shopt -q login_shell ; then # We're not a login shell
# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
# Only display echos from profile.d scripts if we are no login shell
# and interactive - otherwise just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done
unset i
unset pathmunge
fi
# User specific aliases and functions
export EDITOR=vim
export SVN_EDITOR=vim
export GREP_OPTIONS='--color=auto'
alias ls='ls -G'
alias l='ls -Fa'
alias ll='ls -la'
#sort by mod time:
alias lll='ls -Falot'
#sort by size:
alias llll='ls -laS'
alias cp='cp -v -i'
alias rm='rm -i'
alias mv='mv -v -i'
alias mike='echo IS THE SHIT!'
# "search no svn" - look for an expression in all files
# under dir (current if unspecified), but skip .svn directories
function sns()
{
if [ $# == 1 ]; then
grep -r --exclude-dir=.svn --exclude-dir=.git "$1" .
elif [ $# == 2 ]; then
grep -r --exclude-dir=.svn --exclude-dir=.git "$2" $1
else
echo 'usage: sns [dir] expression'
fi
}
function mkcd()
{
mkdir $1; cd $1
}
function runfree()
{
if [ $# -gt 6 ]; then
echo "ehh... go edit your .bashrc"
else
nohup $1 $2 $3 $4 $5 $6 1>/dev/null 2>/dev/null &
fi
}
function labiblala()
{
pdflatex $1.tex; bibtex $1.aux; pdflatex $1.tex; pdflatex $1.tex
}
## Coloured two-line prompt
# NOTE: non-displaying characters must be surrounded by \[ & \] in order for bash to interpret them properly. Otherwise you get visual glitches when typing long commands.
#PS1="`setterm -bold on`\[\033[36m\] \u@\h `tty | sed 's/\/dev\///'` \t \d \[\033[1;31m\]\w/ \n\[\033[36m\] $\[\033[0m\] `setterm -bold off`"
#PS1="\[`setterm -bold on`\033[32m\][\u@\h \[\033[1;31m\]\W/\[\033[32m\]]\$\[\033[0m`setterm -bold off`\] "
BOLD="\[\033[1m\]"
OFF="\[\033[m\]"
PS1="${BOLD}\[\033[32m\][\u@\h \[\033[31m\]\W/\[\033[32m\]]\$\[\033[0m\]${OFF} "
# had issues with brew and pkg-config one day. this solved them.
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/X11/lib/pkgconfig
# Host-specific configs
case $(hostname -s) in
"shinestructure")
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi
export GEM_HOME=~/gems
export PGHOST=localhost
alias retina='open ~/scripts/retina.app'
;;
"shininess")
# for homebrew-installed ruby
PATH=/usr/local/opt/ruby/bin:$PATH
# for android `adb` tool
PATH=/Users/mziwisky/dev/android-sdk-macosx/platform-tools:$PATH
# for android `ndk-build` and company
PATH=/Users/mziwisky/dev/android-ndk-r9:$PATH
;;
esac
# enable chruby and auto-switching (using .ruby-version file)
[ -f /usr/local/share/chruby/chruby.sh ] && . /usr/local/share/chruby/chruby.sh
[ -f /usr/local/share/chruby/auto.sh ] && . /usr/local/share/chruby/auto.sh