dotfiles/.bashrc

60 lines
1.9 KiB
Bash
Raw Normal View History

# [----------------------------------------------------------------------------]
# [----------------------------- 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
LINE=$LINE"\e(0q\e(B"
done
PS1="\e[1;34m[\t] \w ${LINE}\n"
if [ "$SSH_CONNECTION" == "" ]; then
# Yellow prompt for local login
PS1="$PS1\[\e[1;32m\][\u@\h]"
else
PS1="$PS1\[\e[1;33m\][\u@\h]"
fi
PS1="$PS1\$(if [ \$? = 0 ]; then echo -e \"\$\"; else echo -e \"\[\033[0;31m\]\$\"; fi)\[\033[0m\] "
}
PROMPT_COMMAND=prompt
# [----------------------------------------------------------------------------]
# [----------------------------- ALIAS ---------------------------------------]
# [----------------------------------------------------------------------------]
2012-04-05 05:39:31 -04:00
# Common parameters
if [ "$OSTYPE" == "linux-gnu" ]; then
alias ls='ls -v --color=auto'
alias ll='ls -lavh'
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
# [----------------------------------------------------------------------------]
# [------------------------------ 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
# [----------------------------------------------------------------------------]
# [------------------------------ PATH ----------------------------------------]
# [----------------------------------------------------------------------------]
2012-11-30 13:36:26 -05:00
PATH=$PATH:$HOME/bin