added more stuff, improved the way interactive vs non-interactive is being handled
parent
f68aff5b12
commit
cfcaad3bbe
103
ultimate.bashrc
103
ultimate.bashrc
|
@ -1,39 +1,78 @@
|
|||
|
||||
# ALWAYS RUN
|
||||
# ==========
|
||||
# things to always set up, even for inactive shells
|
||||
|
||||
# Fuck vi!
|
||||
EDITOR=nano
|
||||
# On FreeBSD this is being set for whatever reason in the other shell rc files. I'll leave it here for compatibility.
|
||||
PAGER=less
|
||||
|
||||
export EDITOR PAGER
|
||||
|
||||
|
||||
# CHECK INTERACTIVE
|
||||
# =================
|
||||
# Don't do anything after this if not running an interactive shell.
|
||||
case $- in
|
||||
*i*)
|
||||
alias h="history 25"
|
||||
alias j="jobs -l"
|
||||
alias ls="ls --color=auto"
|
||||
alias la="ls -aF"
|
||||
alias lf="ls -FA"
|
||||
alias ll="ls -lAF"
|
||||
[[ -f /usr/local/share/bash-completion/bash_completion.sh ]] && source /usr/local/share/bash-completion/bash_completion.sh
|
||||
PROMPT_COMMAND="PS1=\"[\[\e[03$(
|
||||
if [ $EUID -eq 0 ]
|
||||
then
|
||||
echo '1;02m'
|
||||
else
|
||||
if [ -n "$(groups | grep 'wheel')" ];
|
||||
then
|
||||
echo '2;01m'
|
||||
else
|
||||
echo '6;01m'
|
||||
fi
|
||||
fi
|
||||
)\]\u@\h\[\e[0m\]]:\$(
|
||||
PROMPT_ERRORLEVEL=\$?
|
||||
if [ \$PROMPT_ERRORLEVEL -eq 0 ]
|
||||
then
|
||||
echo -n '\[\e[032;02m\]'
|
||||
else
|
||||
echo -n '\[\e[031;02m\]'
|
||||
fi
|
||||
echo -n \$PROMPT_ERRORLEVEL
|
||||
echo -n '\[\e[00m\]'
|
||||
):\[\e[034;01m\]\$(pwd)\[\e[0m\]:> \""
|
||||
*i*) ;;
|
||||
*) return ;;
|
||||
esac
|
||||
|
||||
# ALIASES
|
||||
# =======
|
||||
alias ls="ls --color=auto"
|
||||
alias la="ls -aF"
|
||||
alias grep="grep --color=auto"
|
||||
|
||||
# BASH COMPLETION
|
||||
# ===============
|
||||
# include bash completions if they exist
|
||||
# (may need to be adjusted to where the bash completions are stored on the current system)
|
||||
|
||||
# Default for FreeBSD:
|
||||
if [ -f /usr/local/share/bash-completion/bash_completion.sh ]; then
|
||||
source /usr/local/share/bash-completion/bash_completion.sh
|
||||
# Default for Linux:
|
||||
elif [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
source /usr/share/bash-completion/bash_completion
|
||||
fi
|
||||
|
||||
# VARIABLES
|
||||
# =========
|
||||
|
||||
# don't put duplicate lines or lines starting with a space in history
|
||||
HISTCONTROL=ingnoreboth
|
||||
# unlimited history
|
||||
HISTSIZE=-1
|
||||
HISTFILESIZE=-1
|
||||
# set a fancy prompt
|
||||
PROMPT_COMMAND="PS1=\"[\[\e[03$(
|
||||
if [ $EUID -eq 0 ]
|
||||
then
|
||||
echo '1;02m'
|
||||
else
|
||||
if [ -n "$(groups | grep 'wheel')" ];
|
||||
then
|
||||
echo '2;01m'
|
||||
else
|
||||
echo '6;01m'
|
||||
fi
|
||||
fi
|
||||
)\]\u@\h\[\e[0m\]]:\$(
|
||||
PROMPT_ERRORLEVEL=\$?
|
||||
if [ \$PROMPT_ERRORLEVEL -eq 0 ]
|
||||
then
|
||||
echo -n '\[\e[032;02m\]'
|
||||
else
|
||||
echo -n '\[\e[031;02m\]'
|
||||
fi
|
||||
echo -n \$PROMPT_ERRORLEVEL
|
||||
echo -n '\[\e[00m\]'
|
||||
):\[\e[034;01m\]\$(pwd)\[\e[0m\]:> \""
|
||||
|
||||
# SHELL OPTIONS
|
||||
# =============
|
||||
shopt -s histappend
|
||||
shopt -s checkwinsize
|
||||
shopt -s globstar
|
||||
|
||||
|
|
Loading…
Reference in New Issue