Mercurial > ec-dotfiles
annotate rc/bashrc @ 515:023071785b97
Updated fingerprint.
| author | edogawaconan <me@myconan.net> | 
|---|---|
| date | Wed, 09 Apr 2014 06:43:59 +0400 | 
| parents | 13deb0e1a2cc | 
| children | 6ef4bbc171eb | 
| rev | line source | 
|---|---|
| 43 | 1 #!/usr/bin/env bash | 
| 2 | |
| 242 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 Edho Arief <edho@myconan.net> parents: 
238diff
changeset | 3 case "${-}" in | 
| 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 Edho Arief <edho@myconan.net> parents: 
238diff
changeset | 4 *i*) ;; | 
| 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 Edho Arief <edho@myconan.net> parents: 
238diff
changeset | 5 *) return;; | 
| 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 Edho Arief <edho@myconan.net> parents: 
238diff
changeset | 6 esac | 
| 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 Edho Arief <edho@myconan.net> parents: 
238diff
changeset | 7 | 
| 117 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 Edho Prima Arief <edho@myconan.net> parents: 
112diff
changeset | 8 if [ "${ECOS_BASH_LOADED}" != "yes" ]; then | 
| 122 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 Edho Prima Arief <edho@myconan.net> parents: 
117diff
changeset | 9 ECOS_BASH_LOADED="yes" | 
| 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 Edho Prima Arief <edho@myconan.net> parents: 
117diff
changeset | 10 else | 
| 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 Edho Prima Arief <edho@myconan.net> parents: 
117diff
changeset | 11 return | 
| 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 Edho Prima Arief <edho@myconan.net> parents: 
117diff
changeset | 12 fi | 
| 117 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 Edho Prima Arief <edho@myconan.net> parents: 
112diff
changeset | 13 | 
| 71 | 14 [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before" | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 15 | 
| 385 | 16 _org_path="${PATH}" | 
| 386 | 17 | 
| 501 | 18 _os="$(uname -s)" | 
| 19 | |
| 386 | 20 # Basic PATH | 
| 468 | 21 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games" | 
| 385 | 22 | 
| 23 # pkgsrc | |
| 24 if test -d /usr/pkg; then | |
| 25 PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin" | |
| 26 if test -d /usr/pkg/java/openjdk7; then | |
| 27 # OpenJDK 7 in pkgsrc | |
| 28 PATH="${PATH}:/usr/pkg/java/openjdk7/bin" | |
| 29 fi | |
| 30 fi | |
| 460 | 31 | 
| 387 | 32 # OpenBSD X11 | 
| 33 test -d /usr/X11R6/bin && PATH="${PATH}:/usr/X11R6/bin" | |
| 34 # PostgreSQL Yum | |
| 440 
abbdb936a36a
Automated pgsql yum version detect.
 Edho Arief <edho@myconan.net> parents: 
439diff
changeset | 35 # Defaults to last version available. | 
| 
abbdb936a36a
Automated pgsql yum version detect.
 Edho Arief <edho@myconan.net> parents: 
439diff
changeset | 36 _pgbindir=(/usr/pgsql-*/bin) | 
| 
abbdb936a36a
Automated pgsql yum version detect.
 Edho Arief <edho@myconan.net> parents: 
439diff
changeset | 37 _pgbindir="${_pgbindir[@]:(-1)}" | 
| 
abbdb936a36a
Automated pgsql yum version detect.
 Edho Arief <edho@myconan.net> parents: 
439diff
changeset | 38 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}" | 
| 
abbdb936a36a
Automated pgsql yum version detect.
 Edho Arief <edho@myconan.net> parents: 
439diff
changeset | 39 unset _pgbindir | 
| 385 | 40 | 
| 439 | 41 # PostgreSQL EnterpriseDB | 
| 42 # Defaults to last version available. | |
| 43 _pgbindir=(/opt/PostgreSQL/*/bin) | |
| 44 _pgbindir="${_pgbindir[@]:(-1)}" | |
| 45 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}" | |
| 46 unset _pgbindir | |
| 47 | |
| 372 | 48 # Nuke currently defined functions | 
| 396 | 49 unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1) | 
| 372 | 50 | 
| 374 | 51 # Nuke bash-completion | 
| 52 complete -r | |
| 53 | |
| 380 | 54 # Nuke aliases | 
| 55 unalias -a | |
| 56 | |
| 111 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 57 shopt -s histappend | 
| 499 | 58 HISTSIZE=20000 | 
| 59 HISTFILESIZE=$HISTSIZE | |
| 60 HISTCONTROL=ignorespace:ignoredups:erasedups | |
| 61 PROMPT_COMMAND='history -a; history -c; history -r' | |
| 111 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 62 | 
| 414 | 63 export PAGER=more | 
| 64 export EDITOR=vi | |
| 89 
29bd7f6ef58a
Explicit LANG declaration.
 Edho Prima Arief <me@myconan.net> parents: 
60diff
changeset | 65 export LANG="en_US.UTF-8" | 
| 461 | 66 export LC_CTYPE="en_US.UTF-8" | 
| 355 | 67 # The en_US.UTF-8 causes weird sorting. | 
| 68 # (not really, but I prefer C based sort.) | |
| 414 | 69 export LC_COLLATE=C | 
| 413 
fda660f86df3
Don't set lc_messages to utf-8. Just use plain C.
 Edho Arief <edho@myconan.net> parents: 
407diff
changeset | 70 export LC_MESSAGES=C | 
| 267 
e35a36bb832e
Always export LSCOLORS and CLICOLOR
 Edho Arief <edho@myconan.net> parents: 
266diff
changeset | 71 export CLICOLOR= | 
| 342 
4a37643931c4
[rc/bashrc] Better color for solarized and general (blue -> cyan).
 Edho Arief <edho@myconan.net> parents: 
335diff
changeset | 72 export LSCOLORS="gxfxcxdxbxegedabagacad" | 
| 307 | 73 export LS_COLORS= | 
| 309 
592605e4d3bb
Use SI whenever possible. Use 1KiB instead otherwise.
 Edho Arief <edho@myconan.net> parents: 
308diff
changeset | 74 export BLOCKSIZE=1K | 
| 
592605e4d3bb
Use SI whenever possible. Use 1KiB instead otherwise.
 Edho Arief <edho@myconan.net> parents: 
308diff
changeset | 75 export BLOCK_SIZE=si | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 76 | 
| 62 | 77 alias ls="ls -F" | 
| 288 | 78 alias rd="rdesktop -g 1280x600 -K -a 15 -x m -z -P -r sound:off -r clipboard:CLIPBOARD -5" | 
| 360 
59dc2f13e0ae
Set default locale for man(1) to C.
 Edho Arief <edho@myconan.net> parents: 
355diff
changeset | 79 alias man="LANG=C man" | 
| 477 | 80 alias be="bundle exec" | 
| 81 alias ll="ls -l" | |
| 82 alias la="ls -A" | |
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 83 | 
| 43 | 84 _has_gnu_ls= | 
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 85 _has_gnu_grep= | 
| 238 
5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
 Edho Arief <edho@myconan.net> parents: 
141diff
changeset | 86 _ls="ls" | 
| 270 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 87 _grep="grep" | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 88 _has_posix_grep=y | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 89 | 
| 506 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 90 if [ SunOS = "${_os}" ]; then | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 91 if [ -f /usr/share/lib/terminfo/s/screen ]; then | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 92 export TERMINFO=/usr/share/lib/terminfo | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 93 elif [ -f /opt/csw/share/terminfo/s/screen ]; then | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 94 export TERMINFO=/opt/csw/share/terminfo | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 95 else | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 96 unset TERMINFO | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 97 export TERM=dtterm | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 98 fi | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 99 | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 100 [ xterm = "${TERM}" ] && export TERM=xterm-256color | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 101 fi | 
| 
84ad2517ac90
Refactor terminal-relatd detection in sunos.
 edogawaconan <me@myconan.net> parents: 
501diff
changeset | 102 | 
| 501 | 103 case "${_os}" in | 
| 43 | 104 Linux) | 
| 105 _has_gnu_ls=y | |
| 96 
26c9dc482051
Merge. Linux obviously has gnu grep.
 Edho Prima Arief <edho@myconan.net> parents: 
75diff
changeset | 106 _has_gnu_grep=y | 
| 43 | 107 ;; | 
| 108 SunOS) | |
| 270 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 109 _has_posix_grep=n | 
| 43 | 110 [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y | 
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 111 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y | 
| 253 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 112 # Higher priority directories | 
| 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 113 for i in {/opt/csw,/usr/gnu}/{,s}bin; do | 
| 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 114 [ -d "${i}" ] && PATH="${i}:${PATH}" | 
| 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 115 done | 
| 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 116 for i in /usr/{sfw,xpg4}/bin; do | 
| 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 117 [ -d "${i}" ] && PATH="${PATH}:${i}" | 
| 
e6de49d70fe7
(Not so) simplified solaris path add.
 Edho Arief <edho@myconan.net> parents: 
252diff
changeset | 118 done | 
| 333 
aeb51856e281
[rc/bash] Solaris: additional path, removed useless test.
 Edho Arief <edho@myconan.net> parents: 
326diff
changeset | 119 [ -d "/opt/csw/gnu" ] && PATH="/opt/csw/gnu:${PATH}" | 
| 511 
ce21ebae61b4
Add /opt/local beforehand in sunos.
 edogawaconan <me@myconan.net> parents: 
510diff
changeset | 120 [ -d "/opt/local/sbin" ] && PATH="/opt/local/sbin:${PATH}" | 
| 
ce21ebae61b4
Add /opt/local beforehand in sunos.
 edogawaconan <me@myconan.net> parents: 
510diff
changeset | 121 [ -d "/opt/local/bin" ] && PATH="/opt/local/bin:${PATH}" | 
| 57 
ada5b9534765
[bash] Sanitize sunos ping.
 Edho Prima Arief <me@myconan.net> parents: 
56diff
changeset | 122 alias ping="ping -s" | 
| 
ada5b9534765
[bash] Sanitize sunos ping.
 Edho Prima Arief <me@myconan.net> parents: 
56diff
changeset | 123 alias ping6="ping -A inet6" | 
| 270 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 124 if command -v ggrep > /dev/null 2>&1; then | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 125 _has_gnu_grep=y | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 126 _grep="ggrep" | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 127 fi | 
| 272 | 128 if command -v gls > /dev/null 2>&1; then | 
| 129 _has_gnu_ls=y | |
| 130 _ls="gls" | |
| 131 fi | |
| 43 | 132 ;; | 
| 275 | 133 FreeBSD) | 
| 134 # Invalid characters when using en_US.UTF-8. | |
| 135 alias man="man -o" | |
| 278 | 136 # Multi CPU awesomeness. | 
| 137 alias top="top -P" | |
| 453 
c3bfb45757e9
FreeBSD grep is GNU grep. Well, up to 9.x.
 Edho Arief <edho@myconan.net> parents: 
440diff
changeset | 138 # FreeBSD grep is GNU grep | 
| 
c3bfb45757e9
FreeBSD grep is GNU grep. Well, up to 9.x.
 Edho Arief <edho@myconan.net> parents: 
440diff
changeset | 139 _has_gnu_grep=y | 
| 275 | 140 ;; | 
| 62 | 141 OpenBSD) | 
| 407 
e5739479dc53
Prioritize colorls in openbsd.
 Edho Arief <edho@myconan.net> parents: 
403diff
changeset | 142 # GNU ls is broken in 5.2. Prioritize colorls instead. | 
| 
e5739479dc53
Prioritize colorls in openbsd.
 Edho Arief <edho@myconan.net> parents: 
403diff
changeset | 143 if command -v colorls > /dev/null 2>&1; then | 
| 
e5739479dc53
Prioritize colorls in openbsd.
 Edho Arief <edho@myconan.net> parents: 
403diff
changeset | 144 alias ls="colorls -F" | 
| 
e5739479dc53
Prioritize colorls in openbsd.
 Edho Arief <edho@myconan.net> parents: 
403diff
changeset | 145 elif command -v gls > /dev/null 2>&1; then | 
| 238 
5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
 Edho Arief <edho@myconan.net> parents: 
141diff
changeset | 146 _has_gnu_ls=y | 
| 
5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
 Edho Arief <edho@myconan.net> parents: 
141diff
changeset | 147 _ls="gls" | 
| 62 | 148 fi | 
| 149 ;; | |
| 351 
001cdf389aaf
NetBSD and DFBSD use similar package directory structure (pkgsrc).
 Edho Arief <edho@myconan.net> parents: 
345diff
changeset | 150 NetBSD|DragonFly) | 
| 249 | 151 if command -v gls > /dev/null 2>&1; then | 
| 152 _has_gnu_ls=y | |
| 153 _ls="gls" | |
| 154 elif command -v colorls > /dev/null 2>&1; then | |
| 276 | 155 alias ls="colorls -F" | 
| 249 | 156 fi | 
| 367 
37e422bb903b
Grep in color for NetBSD/DragonFly.
 Edho Arief <edho@myconan.net> parents: 
366diff
changeset | 157 alias grep='grep --color=auto' | 
| 249 | 158 ;; | 
| 67 | 159 CYGWIN*) | 
| 160 export PATH="${PATH}:${_org_path}" | |
| 161 ;; | |
| 43 | 162 esac | 
| 163 | |
| 314 | 164 if [ "${_has_gnu_ls}" = y ]; then | 
| 165 alias ls="${_ls} -F --color=auto" | |
| 166 LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.xml=32:*.rdf=32:*.css=32:*.js=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*,v=01;33:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:'; | |
| 167 export LS_COLORS | |
| 168 fi | |
| 270 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 169 if [ "${_has_gnu_grep}" = y ]; then | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 170 alias grep="${_grep} --color=auto" | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 171 _has_posix_grep=y | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 172 fi | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 173 if [ "${_has_posix_grep}" = y ]; then | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 174 alias fgrep="grep -F" | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 175 alias egrep="grep -E" | 
| 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 176 fi | 
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 177 | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 178 unset _has_gnu_ls | 
| 58 | 179 unset _has_gnu_grep | 
| 270 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 180 unset _has_posix_grep | 
| 238 
5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
 Edho Arief <edho@myconan.net> parents: 
141diff
changeset | 181 unset _ls | 
| 270 
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
 Edho Arief <edho@myconan.net> parents: 
269diff
changeset | 182 unset _grep | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 183 | 
| 261 | 184 # Custom application I usually install and safe to prioritize | 
| 438 | 185 for i in {"${HOME}/app","/opt"{,"/${USER:-$LOGNAME}"}}/{tmux,ruby19,python26,node,tarsnap,symon,nginx,p7zip}/{bin,sbin}; do | 
| 261 | 186 [ -d "${i}" ] && PATH="${i}:${PATH}" | 
| 187 done | |
| 304 | 188 # New(?) rubygems bin PATH | 
| 344 | 189 for i in {"${HOME}/app","/opt"{,"/${USER:-$LOGNAME}"}}/ruby19/lib/ruby/gems/1.9.1/bin; do | 
| 304 | 190 [ -d "${i}" ] && PATH="${i}:${PATH}" | 
| 191 done | |
| 261 | 192 | 
| 264 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 193 # MySQL in common locations highest priority since new = better. Also no compatibility problem. | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 194 # Cluster is superset of Enterprise/GPL so it gets highest priority. | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 195 # And use only one. | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 196 for mydir in {"${HOME}",/app{,s},/opt}/mysql/{{cluster,enterprise}/mysql/,}bin; do | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 197 if [ -d "${mydir}" ]; then | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 198 PATH="${mydir}:${PATH}" | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 199 break | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 200 fi | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 201 done | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 202 | 
| 261 | 203 # Mercurial is optional since it will be inconsistent with ssh ... hg if this one gets priority. | 
| 264 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 204 # And use only one. | 
| 281 
87ce8cfdb8d4
Alias for newer hg. Also more search path.
 Edho Arief <edho@myconan.net> parents: 
279diff
changeset | 205 for hgdir in {"${HOME}/app","/opt"}/mercurial{,/bin}; do | 
| 
87ce8cfdb8d4
Alias for newer hg. Also more search path.
 Edho Arief <edho@myconan.net> parents: 
279diff
changeset | 206 hgbin="${hgdir}/hg" | 
| 
87ce8cfdb8d4
Alias for newer hg. Also more search path.
 Edho Arief <edho@myconan.net> parents: 
279diff
changeset | 207 if [ -x "${hgbin}" ]; then | 
| 264 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 208 PATH="${PATH}:${hgdir}" | 
| 281 
87ce8cfdb8d4
Alias for newer hg. Also more search path.
 Edho Arief <edho@myconan.net> parents: 
279diff
changeset | 209 alias nhg="${hgbin}" | 
| 264 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 210 break | 
| 
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
 Edho Arief <edho@myconan.net> parents: 
262diff
changeset | 211 fi | 
| 261 | 212 done | 
| 56 
9343fa4dfd91
[bash] we have vim. Probably.
 Edho Prima Arief <me@myconan.net> parents: 
55diff
changeset | 213 | 
| 273 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 214 for supbindir in {"${HOME}/app","/opt"}/supervisor{,d}/bin; do | 
| 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 215 if [ -d "${supbindir}" ]; then | 
| 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 216 PATH="${PATH}:${supbindir}" | 
| 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 217 break | 
| 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 218 fi | 
| 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 219 done | 
| 
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
 Edho Arief <edho@myconan.net> parents: 
271diff
changeset | 220 | 
| 436 
d6ac822569c4
Updated the uncolored prompt style.
 Edho Arief <edho@myconan.net> parents: 
435diff
changeset | 221 PS1='\u@\h:\w\$ ' | 
| 59 | 222 case "${TERM}" in | 
| 254 
dde04581a2bf
Combined PS1 and PROMPT_COMMAND conditional.
 Edho Arief <edho@myconan.net> parents: 
253diff
changeset | 223 xterm*|screen*|dtterm*) | 
| 271 
003b0c8870b3
As it turns out who am i doesn't respect current actual user. Replaced with ancient but better version. Either LOGNAME or USER. Whichever has value.
 Edho Arief <edho@myconan.net> parents: 
270diff
changeset | 224 PROMPT_COMMAND='echo -ne "\033]0;'"${USER:-$LOGNAME}@$(uname -n)"': ${PWD}\007";'"${PROMPT_COMMAND}" | 
| 352 
038c28c748d0
The color prompt is broken-ish in DFBSD.
 Edho Arief <edho@myconan.net> parents: 
351diff
changeset | 225 # DragonFly's Bash is a bit buggy. | 
| 
038c28c748d0
The color prompt is broken-ish in DFBSD.
 Edho Arief <edho@myconan.net> parents: 
351diff
changeset | 226 if [ "$(uname)" != "DragonFly" ]; then | 
| 435 
4a71d0b1a4c6
Different, more compact style of prompt.
 Edho Arief <edho@myconan.net> parents: 
434diff
changeset | 227 PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;36m\]\w\[\e[0m\]\$ ' | 
| 352 
038c28c748d0
The color prompt is broken-ish in DFBSD.
 Edho Arief <edho@myconan.net> parents: 
351diff
changeset | 228 fi | 
| 59 | 229 ;; | 
| 230 esac | |
| 231 | |
| 501 | 232 # Priority PATHs. Always enable. | 
| 233 PATH="${HOME}/bin:${HOME}/.ecos_bin:/opt/local/bin:/opt/local/sbin:${PATH}" | |
| 234 | |
| 63 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 235 if command -v vim > /dev/null 2>&1; then | 
| 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 236 alias vi=vim | 
| 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 237 export EDITOR=vim | 
| 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 238 fi | 
| 266 | 239 | 
| 296 | 240 if command -v less > /dev/null 2>&1; then | 
| 395 
c01d272af466
Moved less configuration declaration to environment variable.
 Edho Arief <edho@myconan.net> parents: 
360diff
changeset | 241 export PAGER=less | 
| 488 
e3648f0482e5
Automatically exit less when the file is less than one screenful.
 edogawaconan <me@myconan.net> parents: 
477diff
changeset | 242 export LESS=-FMRXginsz-2 | 
| 296 | 243 fi | 
| 244 | |
| 365 | 245 # Test if we have GNU rm prefixed by g (esp if on non-GNU system). | 
| 246 # Usually on old Solaris and {Net,Open,DragonFly}BSD. | |
| 247 if command -v grm > /dev/null 2>&1; then | |
| 248 _rm="grm" | |
| 249 else | |
| 250 _rm="rm" | |
| 251 fi | |
| 252 # Test if the specified rm has "-I" parameter since it's much better. | |
| 253 if "${_rm}" -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null; then | |
| 254 alias rm="${_rm} -I" | |
| 255 else | |
| 256 alias rm="${_rm} -i" | |
| 257 fi | |
| 366 | 258 unset _rm | 
| 266 | 259 | 
| 402 
a23b0f6ee8a2
Add alias for zeropaste posting.
 Edho Arief <edho@myconan.net> parents: 
400diff
changeset | 260 if command -v curl > /dev/null 2>&1; then | 
| 465 | 261 alias 0p="gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[paste_gzip]=<-'" | 
| 466 | 262 alias 0pp="gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[is_private]=1' -F 'paste[paste_gzip]=<-'" | 
| 402 
a23b0f6ee8a2
Add alias for zeropaste posting.
 Edho Arief <edho@myconan.net> parents: 
400diff
changeset | 263 fi | 
| 
a23b0f6ee8a2
Add alias for zeropaste posting.
 Edho Arief <edho@myconan.net> parents: 
400diff
changeset | 264 | 
| 501 | 265 if command -v tmux > /dev/null 2>&1; then | 
| 266 case "${_os}" in | |
| 267 OpenBSD) | |
| 268 # FIXME: OpenBSD version check | |
| 269 _tmux_conf_ver=1.9 | |
| 270 ;; | |
| 271 *) | |
| 514 
13deb0e1a2cc
tmux 1.3 doesn't have -V parameter.
 edogawaconan <me@myconan.net> parents: 
511diff
changeset | 272 case "$(tmux -V 2> /dev/null)" in | 
| 501 | 273 "tmux 1."[1-9][0-9]*|"tmux 1.9"*) _tmux_conf_ver=1.9;; | 
| 274 "tmux 1."[4-8]*) _tmux_conf_ver=1.4;; | |
| 275 *) _tmux_conf_ver=1.3;; | |
| 276 esac | |
| 277 ;; | |
| 278 esac | |
| 279 alias tmux="tmux -f '""${HOME}""/.tmux-""${_tmux_conf_ver}"".conf'" | |
| 280 unset _tmux_conf_ver | |
| 281 fi | |
| 282 | |
| 283 unset _os | |
| 464 | 284 | 
| 71 | 285 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after" | 
