2013-02-23 05:38:12 -05:00
|
|
|
# [----------------------------------------------------------------------------]
|
|
|
|
# [----------------------------- PROMPT ---------------------------------------]
|
|
|
|
# [----------------------------------------------------------------------------]
|
|
|
|
hostn=$(hostname -s)
|
|
|
|
usern=$(whoami)
|
|
|
|
|
|
|
|
function prompt {
|
|
|
|
ctime=$(date +%T)
|
|
|
|
prmpt="[${PWD}][${ctime}]"
|
|
|
|
cols=$(tput cols)
|
|
|
|
let FILLS=${cols}-${#prmpt}
|
|
|
|
LINE=""
|
|
|
|
|
|
|
|
if [[ "$PWD" =~ "/home/$usern" ]]; then
|
|
|
|
let FILLS=$FILLS+5+${#usern}
|
|
|
|
fi
|
|
|
|
|
|
|
|
for (( f=0; f<$FILLS; f++ ))
|
|
|
|
do
|
2013-02-23 14:16:31 -05:00
|
|
|
LINE=$LINE"\e[0;34;44m-"
|
2013-02-23 05:38:12 -05:00
|
|
|
done
|
|
|
|
|
2013-02-23 14:16:31 -05:00
|
|
|
PS1="\e[44;1;37m[\t] \w ${LINE}\e[0m\n"
|
2013-02-23 05:38:12 -05:00
|
|
|
if [ "$SSH_CONNECTION" == "" ]; then
|
|
|
|
# Yellow prompt for local login
|
2013-02-23 14:16:31 -05:00
|
|
|
PS1="$PS1\[\e[1;32;40m\][\u@\h]"
|
2013-02-23 05:38:12 -05:00
|
|
|
else
|
2013-02-23 14:16:31 -05:00
|
|
|
PS1="$PS1\[\e[1;32;40m\][\u@\h]"
|
2013-02-23 05:38:12 -05:00
|
|
|
fi
|
2013-02-23 14:16:31 -05:00
|
|
|
PS1="$PS1\$(if [ \$? = 0 ]; then echo -e \"\$\"; else echo -e \"\[\e[0;31m\]\$\"; fi)\[\e[0m\] "
|
2013-02-23 05:38:12 -05:00
|
|
|
}
|
|
|
|
PROMPT_COMMAND=prompt
|
|
|
|
|
|
|
|
# [----------------------------------------------------------------------------]
|
|
|
|
# [----------------------------- ALIAS ---------------------------------------]
|
|
|
|
# [----------------------------------------------------------------------------]
|
2012-04-05 05:39:31 -04:00
|
|
|
# Common parameters
|
2012-07-19 15:57:06 -04:00
|
|
|
if [ "$OSTYPE" == "linux-gnu" ]; then
|
|
|
|
alias ls='ls -v --color=auto'
|
2013-02-23 05:38:12 -05:00
|
|
|
alias ll='ls -lavh'
|
2012-07-19 15:57:06 -04:00
|
|
|
alias grep='grep --color'
|
|
|
|
else
|
|
|
|
alias ls='ls'
|
|
|
|
alias ll='ls -la'
|
|
|
|
alias grep='grep'
|
|
|
|
fi
|
2012-04-05 05:39:31 -04:00
|
|
|
|
2013-02-22 05:04:26 -05:00
|
|
|
alias sudo='sudo env PATH=$PATH'
|
2012-08-14 14:26:28 -04:00
|
|
|
|
2013-02-23 05:38:12 -05:00
|
|
|
# [----------------------------------------------------------------------------]
|
|
|
|
# [------------------------------ OTHER ---------------------------------------]
|
|
|
|
# [----------------------------------------------------------------------------]
|
2012-04-05 05:39:31 -04:00
|
|
|
# Case insensitive matching
|
2012-05-15 14:50:49 -04:00
|
|
|
shopt -s nocaseglob
|
2012-07-19 15:39:23 -04:00
|
|
|
|
2013-02-23 05:38:12 -05:00
|
|
|
# [----------------------------------------------------------------------------]
|
|
|
|
# [------------------------------ PATH ----------------------------------------]
|
|
|
|
# [----------------------------------------------------------------------------]
|
2012-11-30 13:36:26 -05:00
|
|
|
PATH=$PATH:$HOME/bin
|