Created
November 7, 2014 04:17
-
-
Save Dark-Arcana/3160c74d77862b85a4c8 to your computer and use it in GitHub Desktop.
This file contains 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
# | |
# /etc/bash.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
PS1="\[\e[00;36m\]\u@\h:\[\e[00;32m\]\w \[\e[00;36m\]>\[\e[00;00m\] " | |
# Bash won't get SIGWINCH if another process is in the foreground. | |
# Enable checkwinsize so that bash will check the terminal size when | |
# it regains control. | |
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11) | |
shopt -s checkwinsize | |
# Enable history appending instead of overwriting. | |
shopt -s histappend | |
case ${TERM} in | |
xterm*|rxvt*|Eterm|aterm|kterm|gnome*) | |
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' | |
;; | |
screen) | |
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' | |
;; | |
esac | |
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion | |
# fortune is a simple program that displays a pseudorandom message | |
# from a database of quotations at logon and/or logout. | |
# If you wish to use it, please install "fortune-mod" from the | |
# official repositories, then uncomment the following line: | |
[[ "$PS1" ]] && echo -e "\e[00;33m$(/usr/bin/fortune)\e[00m" | |
# Arch latest news | |
if [ "$PS1" ] && [[ $(ping -c1 www.google.com 2>&-) ]]; then | |
# The characters "£, §" are used as metacharacters. They should not be encountered in a feed... | |
echo -e "$(echo $(curl --silent https://www.archlinux.org/feeds/news/ | awk ' NR == 1 {while ($0 !~ /<\/item>/) {print;getline} sub(/<\/item>.*/,"</item>") ;print}' | sed -e ':a;N;$!ba;s/\n/ /g') | \ | |
sed -e 's/&/\&/g | |
s/<\|</</g | |
s/>\|>/>/g | |
s/<\/a>/£/g | |
s/href\=\"/§/g | |
s/<title>/\\n\\n\\n :: \\e[01;31m/g; s/<\/title>/\\e[00m ::\\n/g | |
s/<link>/ [ \\e[01;36m/g; s/<\/link>/\\e[00m ]/g | |
s/<description>/\\n\\n\\e[00;37m/g; s/<\/description>/\\e[00m\\n\\n/g | |
s/<p\( [^>]*\)\?>\|<br\s*\/\?>/\n/g | |
s/<b\( [^>]*\)\?>\|<strong\( [^>]*\)\?>/\\e[01;30m/g; s/<\/b>\|<\/strong>/\\e[00;37m/g | |
s/<i\( [^>]*\)\?>\|<em\( [^>]*\)\?>/\\e[41;37m/g; s/<\/i>\|<\/em>/\\e[00;37m/g | |
s/<u\( [^>]*\)\?>/\\e[4;37m/g; s/<\/u>/\\e[00;37m/g | |
s/<code\( [^>]*\)\?>/\\e[00m/g; s/<\/code>/\\e[00;37m/g | |
s/<a[^§|t]*§\([^\"]*\)\"[^>]*>\([^£]*\)[^£]*£/\\e[01;31m\2\\e[00;37m \\e[01;34m[\\e[00;37m \\e[04m\1\\e[00;37m\\e[01;34m ]\\e[00;37m/g | |
s/<li\( [^>]*\)\?>/\n \\e[01;34m*\\e[00;37m /g | |
s/<!\[CDATA\[\|\]\]>//g | |
s/\|>\s*<//g | |
s/ *<[^>]\+> */ /g | |
s/[<>£§]//g')\n\n"; | |
fi | |
# Set up Color | |
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 | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
# test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
eval `dircolors` | |
LS_COLORS="$LS_COLORS*.JPG=01;35:*.GIF=01;35:*.jpg=01;35:*.gif=01;35:*.jpeg=01;35:*.pcx=01;35:*.png=01;35:*.pnm=01;35:*.bz2=01;31:*.mpg=01;38:*.mpeg=01;38:*.MPG=01;38:*.MPEG=01;38:*.m4v=01;038:*.mp4=01;038:*.swf=01;038:*.avi=01;38:*.AVI=01;38:*.wmv=01;38:*.WMV=01;38:*.asf=01;38:*.ASF=01;38:*.mov=01;38:*.MOV=01;38:*.mp3=01;39:*.ogg=01;39:*.MP3=01;39:*.Mp3=01;39" | |
fi | |
# 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="\[\e[00;36m\]\u@\h:\[\e[00;32m\]\w \[\e[00;36m\]>\[\e[00;00m\] " | |
alias ls='ls -A --color=auto --format=horizontal' | |
alias lsall='ls -hAgp --color=auto --format=long' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --colour=auto' | |
alias egrep='egrep --colour=auto' | |
alias ll='ls -lF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
else | |
if [[ ${EUID} == 0 ]] ; then | |
# show root@ when we don't have colors | |
PS1='\u@\h \W \$ ' | |
else | |
PS1='\u@\h \w \$ ' | |
fi | |
fi | |
# Try to keep environment pollution down, EPA loves us. | |
unset use_color safe_term match_lhs | |
# Colored Escape Characters | |
colors() { | |
local fgc bgc vals seq0 | |
printf "Color escapes are %s\n" '\e[${value};...;${value}m' | |
printf "Values 30..37 are \e[33mforeground colors\e[m\n" | |
printf "Values 40..47 are \e[43mbackground colors\e[m\n" | |
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n" | |
# foreground colors | |
for fgc in {30..37}; do | |
# background colors | |
for bgc in {40..47}; do | |
fgc=${fgc#37} # white | |
bgc=${bgc#40} # black | |
vals="${fgc:+$fgc;}${bgc}" | |
vals=${vals%%;} | |
seq0="${vals:+\e[${vals}m}" | |
printf " %-9s" "${seq0:-(default)}" | |
printf " ${seq0}TEXT\e[m" | |
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" | |
done | |
echo; echo | |
done | |
} | |
# Colorized git prompt | |
source /usr/share/git/completion/git-prompt.sh | |
export EDITOR=/usr/bin/nano | |
# Colored man files | |
man() { | |
env LESS_TERMCAP_mb=$'\E[01;31m' \ | |
LESS_TERMCAP_md=$'\E[01;38;5;74m' \ | |
LESS_TERMCAP_me=$'\E[0m' \ | |
LESS_TERMCAP_se=$'\E[0m' \ | |
LESS_TERMCAP_so=$'\E[38;5;246m' \ | |
LESS_TERMCAP_ue=$'\E[0m' \ | |
LESS_TERMCAP_us=$'\E[04;38;5;146m' \ | |
man "$@" | |
} | |
export JAVA_HOME=/usr/lib/jvm/java-7-jdk/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment