Mercurial > ec-dotfiles
view rc/bash @ 285:624eead87f86
Merge.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Thu, 22 Dec 2011 15:00:25 +0700 |
parents | 87ce8cfdb8d4 |
children | 9d5247df20e9 5fbe9461efea |
line wrap: on
line source
#!/usr/bin/env bash case "${-}" in *i*) ;; *) return;; esac if [ "${ECOS_BASH_LOADED}" != "yes" ]; then ECOS_BASH_LOADED="yes" else return fi [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before" _org_path="${PATH}" export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" shopt -s histappend PROMPT_COMMAND="history -a" export HISTFILESIZE=10000 export HISTCONTROL=ignoredups export PAGER="less -Rins" export EDITOR=vi export LANG="en_US.UTF-8" export CLICOLOR= export LSCOLORS=ExGxFxdxCxegedabagExEx alias less="less -Rins" alias ls="ls -F" alias rm="rm -i" alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5" _has_gnu_ls= _has_gnu_grep= _ls="ls" _grep="grep" _has_posix_grep=y case "$(uname -s)" in Linux) _has_gnu_ls=y _has_gnu_grep=y ;; SunOS) _has_posix_grep=n [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y # Higher priority directories for i in {/opt/csw,/usr/gnu}/{,s}bin; do [ -d "${i}" ] && PATH="${i}:${PATH}" done for i in /usr/{sfw,xpg4}/bin; do [ -d "${i}" ] && PATH="${PATH}:${i}" done alias ping="ping -s" alias ping6="ping -A inet6" # Hello tmux. Perhaps one day we'll have title with dtterm. # But for now we work this around by prepending tmux call with xterm-256color # which hopefully exists. Otherwise we have to live with no title. if [ -f /usr/share/lib/terminfo/x/xterm-256color ]; then alias tmux="TERM=xterm-256color tmux" else echo "No xterm-256color, using dtterm. Tmux title won't work." fi [ -f /usr/share/lib/terminfo/?/"${TERM}" ] || export TERM=dtterm if command -v ggrep > /dev/null 2>&1; then _has_gnu_grep=y _grep="ggrep" fi if command -v gls > /dev/null 2>&1; then _has_gnu_ls=y _ls="gls" fi ;; FreeBSD) # Invalid characters when using en_US.UTF-8. alias man="man -o" # Multi CPU awesomeness. alias top="top -P" ;; OpenBSD) PATH="${PATH}:/usr/X11R6/bin" if command -v gls > /dev/null 2>&1; then _has_gnu_ls=y _ls="gls" elif command -v colorls > /dev/null 2>&1; then alias ls="colorls -F" fi ;; NetBSD) PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin" if command -v gls > /dev/null 2>&1; then _has_gnu_ls=y _ls="gls" elif command -v colorls > /dev/null 2>&1; then alias ls="colorls -F" fi ;; CYGWIN*) export PATH="${PATH}:${_org_path}" ;; esac [ "${_has_gnu_ls}" = y ] && alias ls="${_ls} -F --color=auto" if [ "${_has_gnu_grep}" = y ]; then alias grep="${_grep} --color=auto" _has_posix_grep=y fi if [ "${_has_posix_grep}" = y ]; then alias fgrep="grep -F" alias egrep="grep -E" fi unset _has_gnu_ls unset _has_gnu_grep unset _has_posix_grep unset _ls unset _grep # Custom application I usually install and safe to prioritize for i in {"${HOME}/app","/opt"}/{tmux,ruby19,node,tarsnap,symon,nginx}/{bin,sbin}; do [ -d "${i}" ] && PATH="${i}:${PATH}" done # MySQL in common locations highest priority since new = better. Also no compatibility problem. # Cluster is superset of Enterprise/GPL so it gets highest priority. # And use only one. for mydir in {"${HOME}",/app{,s},/opt}/mysql/{{cluster,enterprise}/mysql/,}bin; do if [ -d "${mydir}" ]; then PATH="${mydir}:${PATH}" break fi done # Mercurial is optional since it will be inconsistent with ssh ... hg if this one gets priority. # And use only one. for hgdir in {"${HOME}/app","/opt"}/mercurial{,/bin}; do hgbin="${hgdir}/hg" if [ -x "${hgbin}" ]; then PATH="${PATH}:${hgdir}" alias nhg="${hgbin}" break fi done for supbindir in {"${HOME}/app","/opt"}/supervisor{,d}/bin; do if [ -d "${supbindir}" ]; then PATH="${PATH}:${supbindir}" break fi done case "${TERM}" in xterm*|screen*|dtterm*) PROMPT_COMMAND='echo -ne "\033]0;'"${USER:-$LOGNAME}@$(uname -n)"': ${PWD}\007";'"${PROMPT_COMMAND}" PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ ' ;; *) PS1='[\u@\h \W]\$ ' ;; esac if command -v vim > /dev/null 2>&1; then alias vi=vim export EDITOR=vim fi rm -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null && alias rm="rm -I" [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"