-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
43 lines (36 loc) · 897 Bytes
/
.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
#!/bin/bash
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
function get_hostname {
export SHORTNAME=${HOSTNAME}
}
function user_color {
id | grep "Admin" > /dev/null
RETVAL=$?
if [[ $RETVAL == 0 ]]; then
usercolor="[04;38;5;151m";
else
usercolor="[00;38;5;151m";
fi
}
function settitle() {
u=${USERNAME}
h="$u@${HOSTNAME}"
echo -ne "\e]2;$h\a\e]1;$h\a";
}
# Set directory colors
eval `dircolors ~/.dir_colors`
# Set prompt and window title
inputcolor='[0;37m'
cwdcolor='[01;38;5;223m'
host_name='[01;38;5;174m'
user_color
PROMPT_COMMAND='settitle; get_hostname; history -a;'
export PS1='\n\[\e${cwdcolor}\][$PWD]\n\[\e${usercolor}\][\u]\[\e${host_name}\][${SHORTNAME}]\[\e${inputcolor}\] $ '
# Aliases
alias ls='ls -l --color'
alias grep='grep -n --color'