Last active
February 3, 2016 11:20
-
-
Save emlun/0943144ee7b95edd0640 to your computer and use it in GitHub Desktop.
Bare minimum Bash settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ls="ls -h --color=auto" | |
alias ll="ls -lh" | |
alias la="ls -lah" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gentoo-style terminal colors | |
use_color=false | |
# Set colorful PS1 only on colorful terminals. | |
# dircolors --print-database uses its own built-in database | |
# instead of using /etc/DIR_COLORS. Try to use the external file | |
# first to take advantage of user additions. Use internal bash | |
# globbing instead of external grep binary. | |
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM | |
match_lhs="" | |
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" | |
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" | |
[[ -z ${match_lhs} ]] \ | |
&& type -P dircolors >/dev/null \ | |
&& match_lhs=$(dircolors --print-database) | |
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true | |
if ${use_color} ; then | |
source ~/.bash_color_aliases | |
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 | |
if type -P dircolors >/dev/null ; then | |
if [[ -f ~/.dir_colors ]] ; then | |
eval $(dircolors -b ~/.dir_colors) | |
elif [[ -f /etc/DIR_COLORS ]] ; then | |
eval $(dircolors -b /etc/DIR_COLORS) | |
fi | |
fi | |
#PS1='$? ' | |
PROMPT_COMMAND='RET=$?' | |
RET_VALUE='$(echo -n $RET)' | |
#PS1='$(if [[ $RET_VALUE == 0 ]]; then echo -n $txtgrn; else echo -n $txtred; fi)$RET_VALUE\[$txtrst\] ' | |
PS1="\[$txtred\]"'$(if [[ $RET != 0 ]]; then echo -n "$RET "; fi)'"\[$txtrst\]" | |
if [ ${EUID} == 0 ] || [ "${USER}" = "root" ] ; then | |
PS1=$PS1"\[$bldred\]\h" | |
else | |
PS1=$PS1"\[$bldgrn\]\u@\h" | |
fi | |
PS1=$PS1"\[$bldblu\]:\w " | |
# Commented out by FA | |
if [[ 1 == 0 ]] ; then | |
# Display git branch in prompt | |
if hash git 2>/dev/null; then | |
source /usr/share/git-core/contrib/completion/git-prompt.sh | |
PS1=$PS1"\[$txtylw\]"'$(__git_ps1 "(%s) ")' | |
fi | |
fi | |
PS1=$PS1"\[$bldblu\]\$ \[$txtrst\]" | |
alias ls='ls --color=auto' | |
alias grep='grep --colour=auto' | |
else | |
if [[ ${EUID} == 0 ]] ; then | |
# show root@ when we don't have colors | |
PS1='\u@\h:\W \$ ' | |
else | |
PS1='\u@\h:\w \$ ' | |
fi | |
fi | |
export PS1 | |
# Try to keep environment pollution down, EPA loves us. | |
unset use_color safe_term match_lhs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
txtblk='\e[0;30m' # Black - Regular | |
txtred='\e[0;31m' # Red | |
txtgrn='\e[0;32m' # Green | |
txtylw='\e[0;33m' # Yellow | |
txtblu='\e[0;34m' # Blue | |
txtpur='\e[0;35m' # Purple | |
txtcyn='\e[0;36m' # Cyan | |
txtwht='\e[0;37m' # White | |
bldblk='\e[1;30m' # Black - Bold | |
bldred='\e[1;31m' # Red | |
bldgrn='\e[1;32m' # Green | |
bldylw='\e[1;33m' # Yellow | |
bldblu='\e[1;34m' # Blue | |
bldpur='\e[1;35m' # Purple | |
bldcyn='\e[1;36m' # Cyan | |
bldwht='\e[1;37m' # White | |
undblk='\e[4;30m' # Black - Underline | |
undred='\e[4;31m' # Red | |
undgrn='\e[4;32m' # Green | |
undylw='\e[4;33m' # Yellow | |
undblu='\e[4;34m' # Blue | |
undpur='\e[4;35m' # Purple | |
undcyn='\e[4;36m' # Cyan | |
undwht='\e[4;37m' # White | |
bakblk='\e[40m' # Black - Background | |
bakred='\e[41m' # Red | |
bakgrn='\e[42m' # Green | |
bakylw='\e[43m' # Yellow | |
bakblu='\e[44m' # Blue | |
bakpur='\e[45m' # Purple | |
bakcyn='\e[46m' # Cyan | |
bakwht='\e[47m' # White | |
txtrst='\e[0m' # Text Reset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.bash_alias | |
source ~/.bash_color |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment