-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc_slc04chp
102 lines (86 loc) · 2.92 KB
/
bashrc_slc04chp
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
##############################################################################
# Custom Bash Configuration File
##############################################################################
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Aliases #####################################################################
# General
alias more='less'
alias df='df -h'
alias du='du -c -h'
#alias mkdir='mkdir -v'
alias ping='ping -c 5'
alias grep='grep --color=auto'
alias ls='ls -hF --color=auto'
alias g+++='g++ -Wall -Wextra -Wc++11-compat -Wswitch -Wshadow -Weffc++'
alias gccc='gcc -Wall -Wextra -Wswitch -Wshadow'
alias ta='tmux a -t'
alias tl='tmux ls'
alias tnn='tmux new -s '
alias vi='vim'
alias vimdiff='vim -d'
# Safety
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias ln='ln -i'
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
# Colors ######################################################################
if [[ ${EUID} == 0 ]] ; then
PS1="\[\e[01;31m\]\u@\h\[\e[0m\]\[\e[00;31m\]:[\[\e[0m\]\[\e[00;33m\]\w\[\e[0m\]\[\e[00;31m\]]:[\[\e[0m\]\[\e[00;33m\]\$?\[\e[0m\]\[\e[00;31m\]]\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[00;31m\]>>\\$ \[\e[0m\]\[\e[00;37m\]\[\e[0m\]"
else
PS1="\[\e[01;32m\]\u@\h\[\e[0m\]\[\e[00;32m\]:[\[\e[0m\]\[\e[00;33m\]\w\[\e[0m\]\[\e[00;32m\]]:[\[\e[0m\]\[\e[00;33m\]\$?\[\e[0m\]\[\e[00;32m\]]\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[00;32m\]>>\\$ \[\e[0m\]\[\e[00;37m\]\[\e[0m\]"
fi
# Completion ##################################################################
complete -cf sudo
complete -cf man
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Custom binary directories ###################################################
# Custom utility functions ####################################################
# Print single line of a file.
function pline() {
sed -n "$2 {p;q}" $1
}
# Go n directories up.
function up() {
LIMIT=$1
P=$PWD
for ((i=1; i <= LIMIT; i++))
do
P=$P/..
done
cd $P
export MPWD=$P
}
# Go back to directory before issuing up.
function back() {
LIMIT=$1
P=$MPWD
for ((i=1; i <= LIMIT; i++))
do
P=${P%/..}
done
cd $P
export MPWD=$P
}
#make sqlplus work in solaris and linux (download packages first)
set_sqlplus(){
myosis=`uname -sr`
if [[ "$myosis" == *"SunOS"* ]]
then
echo " SKIP! sqlplus for solaris added to path"
export PATH=/home/carlosra/instantclient_11_2/:$PATH
export TNS_ADMIN=/home/carlosra/instantclient_11_2/
export LD_LIBRARY_PATH=/home/carlosra/instantclient_11_2/
else
echo " SKIP! sqlplus for linux added to path"
export PATH=/home/carlosra/instantclient/:$PATH
export TNS_ADMIN=/home/carlosra/instantclient/
export LD_LIBRARY_PATH=/home/carlosra/instantclient/
fi
}
set_sqlplus #ATTENTION executing sqlplus func above.
#add custom functions when uname -sr is SubOS