Mercurial > ec-dotfiles
annotate rc/bashrc @ 526:f579b5310a1b
Add script to map linux ata drive numbering.
author | edogawaconan <me@myconan.net> |
---|---|
date | Sat, 09 Aug 2014 00:24:45 +0900 |
parents | 51a60cc44880 |
children | 0ab0820fd528 |
rev | line source |
---|---|
43 | 1 #!/usr/bin/env bash |
2 | |
242
ebfa844d2ef8
[bash] Also ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents:
238
diff
changeset
|
3 case "${-}" in |
ebfa844d2ef8
[bash] Also ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents:
238
diff
changeset
|
4 *i*) ;; |
ebfa844d2ef8
[bash] Also ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents:
238
diff
changeset
|
5 *) return;; |
ebfa844d2ef8
[bash] Also ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents:
238
diff
changeset
|
6 esac |
ebfa844d2ef8
[bash] Also ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents:
238
diff
changeset
|
7 |
117
548cf46e9cb4
Ensures no double loading using C-style variable test.
Edho Prima Arief <edho@myconan.net>
parents:
112
diff
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:
117
diff
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:
117
diff
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:
117
diff
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:
117
diff
changeset
|
12 fi |
117
548cf46e9cb4
Ensures no double loading using C-style variable test.
Edho Prima Arief <edho@myconan.net>
parents:
112
diff
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:
48
diff
changeset
|
15 |
385 | 16 _org_path="${PATH}" |
386 | 17 |
18 # Basic PATH | |
468 | 19 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games" |
385 | 20 |
520
a60af1e859e4
set PATH before calling uname.
edogawaconan <me@myconan.net>
parents:
516
diff
changeset
|
21 _os="$(uname -s)" |
a60af1e859e4
set PATH before calling uname.
edogawaconan <me@myconan.net>
parents:
516
diff
changeset
|
22 |
385 | 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:
439
diff
changeset
|
35 # Defaults to last version available. |
521 | 36 for _pgbindir in /usr/pgsql-*/bin; do test; done |
440
abbdb936a36a
Automated pgsql yum version detect.
Edho Arief <edho@myconan.net>
parents:
439
diff
changeset
|
37 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}" |
abbdb936a36a
Automated pgsql yum version detect.
Edho Arief <edho@myconan.net>
parents:
439
diff
changeset
|
38 unset _pgbindir |
385 | 39 |
439 | 40 # PostgreSQL EnterpriseDB |
41 # Defaults to last version available. | |
521 | 42 for _pgbindir in /opt/PostgreSQL/*/bin; do test; done |
439 | 43 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}" |
44 unset _pgbindir | |
45 | |
372 | 46 # Nuke currently defined functions |
396 | 47 unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1) |
372 | 48 |
374 | 49 # Nuke bash-completion |
50 complete -r | |
51 | |
380 | 52 # Nuke aliases |
53 unalias -a | |
54 | |
111
fd8dbd4bb758
ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents:
106
diff
changeset
|
55 shopt -s histappend |
499 | 56 HISTSIZE=20000 |
57 HISTFILESIZE=$HISTSIZE | |
58 HISTCONTROL=ignorespace:ignoredups:erasedups | |
59 PROMPT_COMMAND='history -a; history -c; history -r' | |
111
fd8dbd4bb758
ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents:
106
diff
changeset
|
60 |
414 | 61 export PAGER=more |
62 export EDITOR=vi | |
89
29bd7f6ef58a
Explicit LANG declaration.
Edho Prima Arief <me@myconan.net>
parents:
60
diff
changeset
|
63 export LANG="en_US.UTF-8" |
461 | 64 export LC_CTYPE="en_US.UTF-8" |
355 | 65 # The en_US.UTF-8 causes weird sorting. |
66 # (not really, but I prefer C based sort.) | |
414 | 67 export LC_COLLATE=C |
413
fda660f86df3
Don't set lc_messages to utf-8. Just use plain C.
Edho Arief <edho@myconan.net>
parents:
407
diff
changeset
|
68 export LC_MESSAGES=C |
267
e35a36bb832e
Always export LSCOLORS and CLICOLOR
Edho Arief <edho@myconan.net>
parents:
266
diff
changeset
|
69 export CLICOLOR= |
342
4a37643931c4
[rc/bashrc] Better color for solarized and general (blue -> cyan).
Edho Arief <edho@myconan.net>
parents:
335
diff
changeset
|
70 export LSCOLORS="gxfxcxdxbxegedabagacad" |
307 | 71 export LS_COLORS= |
309
592605e4d3bb
Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents:
308
diff
changeset
|
72 export BLOCKSIZE=1K |
592605e4d3bb
Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents:
308
diff
changeset
|
73 export BLOCK_SIZE=si |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
74 |
62 | 75 alias ls="ls -F" |
288 | 76 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:
355
diff
changeset
|
77 alias man="LANG=C man" |
477 | 78 alias be="bundle exec" |
79 alias ll="ls -l" | |
80 alias la="ls -A" | |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
81 |
43 | 82 _has_gnu_ls= |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
83 _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:
141
diff
changeset
|
84 _ls="ls" |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
85 _grep="grep" |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
86 _has_posix_grep=y |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
87 |
506
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
88 if [ SunOS = "${_os}" ]; then |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
89 if [ -f /usr/share/lib/terminfo/s/screen ]; then |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
90 export TERMINFO=/usr/share/lib/terminfo |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
91 elif [ -f /opt/csw/share/terminfo/s/screen ]; then |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
92 export TERMINFO=/opt/csw/share/terminfo |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
93 else |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
94 unset TERMINFO |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
95 export TERM=dtterm |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
96 fi |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
97 |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
98 [ xterm = "${TERM}" ] && export TERM=xterm-256color |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
99 fi |
84ad2517ac90
Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents:
501
diff
changeset
|
100 |
501 | 101 case "${_os}" in |
43 | 102 Linux) |
103 _has_gnu_ls=y | |
96
26c9dc482051
Merge. Linux obviously has gnu grep.
Edho Prima Arief <edho@myconan.net>
parents:
75
diff
changeset
|
104 _has_gnu_grep=y |
43 | 105 ;; |
106 SunOS) | |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
107 _has_posix_grep=n |
43 | 108 [ -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:
52
diff
changeset
|
109 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y |
253
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
110 # Higher priority directories |
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
111 for i in {/opt/csw,/usr/gnu}/{,s}bin; do |
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
112 [ -d "${i}" ] && PATH="${i}:${PATH}" |
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
113 done |
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
114 for i in /usr/{sfw,xpg4}/bin; do |
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
115 [ -d "${i}" ] && PATH="${PATH}:${i}" |
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
116 done |
333
aeb51856e281
[rc/bash] Solaris: additional path, removed useless test.
Edho Arief <edho@myconan.net>
parents:
326
diff
changeset
|
117 [ -d "/opt/csw/gnu" ] && PATH="/opt/csw/gnu:${PATH}" |
511
ce21ebae61b4
Add /opt/local beforehand in sunos.
edogawaconan <me@myconan.net>
parents:
510
diff
changeset
|
118 [ -d "/opt/local/sbin" ] && PATH="/opt/local/sbin:${PATH}" |
ce21ebae61b4
Add /opt/local beforehand in sunos.
edogawaconan <me@myconan.net>
parents:
510
diff
changeset
|
119 [ -d "/opt/local/bin" ] && PATH="/opt/local/bin:${PATH}" |
57
ada5b9534765
[bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents:
56
diff
changeset
|
120 alias ping="ping -s" |
ada5b9534765
[bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents:
56
diff
changeset
|
121 alias ping6="ping -A inet6" |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
122 if command -v ggrep > /dev/null 2>&1; then |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
123 _has_gnu_grep=y |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
124 _grep="ggrep" |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
125 fi |
272 | 126 if command -v gls > /dev/null 2>&1; then |
127 _has_gnu_ls=y | |
128 _ls="gls" | |
129 fi | |
43 | 130 ;; |
275 | 131 FreeBSD) |
132 # Invalid characters when using en_US.UTF-8. | |
133 alias man="man -o" | |
278 | 134 # Multi CPU awesomeness. |
135 alias top="top -P" | |
453
c3bfb45757e9
FreeBSD grep is GNU grep. Well, up to 9.x.
Edho Arief <edho@myconan.net>
parents:
440
diff
changeset
|
136 # FreeBSD grep is GNU grep |
c3bfb45757e9
FreeBSD grep is GNU grep. Well, up to 9.x.
Edho Arief <edho@myconan.net>
parents:
440
diff
changeset
|
137 _has_gnu_grep=y |
275 | 138 ;; |
62 | 139 OpenBSD) |
407
e5739479dc53
Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents:
403
diff
changeset
|
140 # GNU ls is broken in 5.2. Prioritize colorls instead. |
e5739479dc53
Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents:
403
diff
changeset
|
141 if command -v colorls > /dev/null 2>&1; then |
e5739479dc53
Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents:
403
diff
changeset
|
142 alias ls="colorls -F" |
e5739479dc53
Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents:
403
diff
changeset
|
143 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:
141
diff
changeset
|
144 _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:
141
diff
changeset
|
145 _ls="gls" |
62 | 146 fi |
147 ;; | |
351
001cdf389aaf
NetBSD and DFBSD use similar package directory structure (pkgsrc).
Edho Arief <edho@myconan.net>
parents:
345
diff
changeset
|
148 NetBSD|DragonFly) |
249 | 149 if command -v gls > /dev/null 2>&1; then |
150 _has_gnu_ls=y | |
151 _ls="gls" | |
152 elif command -v colorls > /dev/null 2>&1; then | |
276 | 153 alias ls="colorls -F" |
249 | 154 fi |
367
37e422bb903b
Grep in color for NetBSD/DragonFly.
Edho Arief <edho@myconan.net>
parents:
366
diff
changeset
|
155 alias grep='grep --color=auto' |
249 | 156 ;; |
67 | 157 CYGWIN*) |
158 export PATH="${PATH}:${_org_path}" | |
159 ;; | |
43 | 160 esac |
161 | |
314 | 162 if [ "${_has_gnu_ls}" = y ]; then |
163 alias ls="${_ls} -F --color=auto" | |
516
6ef4bbc171eb
Revert to default LS_COLORS. From ubuntu 14.04.
edogawaconan <me@myconan.net>
parents:
514
diff
changeset
|
164 LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'; |
314 | 165 export LS_COLORS |
166 fi | |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
167 if [ "${_has_gnu_grep}" = y ]; then |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
168 alias grep="${_grep} --color=auto" |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
169 _has_posix_grep=y |
523
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
170 |
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
171 alias cgrep="${_grep} --color=always" |
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
172 alias cegrep="cgrep -E" |
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
173 alias cfgrep="cgrep -F" |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
174 fi |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
175 if [ "${_has_posix_grep}" = y ]; then |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
176 alias fgrep="grep -F" |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
177 alias egrep="grep -E" |
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
178 fi |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
179 |
524 | 180 # FIXME: missing test for hg and xargs -0 |
181 _xargs_grep="${_grep}" | |
182 [ "${_has_gnu_grep}" = y ] && _xargs_grep="${_grep} --color=always" | |
183 alias hggrep="hg locate -0 | xargs -0 ${_xargs_grep}" | |
184 unset _xargs_grep | |
185 | |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
186 unset _has_gnu_ls |
58 | 187 unset _has_gnu_grep |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
188 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:
141
diff
changeset
|
189 unset _ls |
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
190 unset _grep |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
191 |
261 | 192 # Custom application I usually install and safe to prioritize |
438 | 193 for i in {"${HOME}/app","/opt"{,"/${USER:-$LOGNAME}"}}/{tmux,ruby19,python26,node,tarsnap,symon,nginx,p7zip}/{bin,sbin}; do |
261 | 194 [ -d "${i}" ] && PATH="${i}:${PATH}" |
195 done | |
304 | 196 # New(?) rubygems bin PATH |
344 | 197 for i in {"${HOME}/app","/opt"{,"/${USER:-$LOGNAME}"}}/ruby19/lib/ruby/gems/1.9.1/bin; do |
304 | 198 [ -d "${i}" ] && PATH="${i}:${PATH}" |
199 done | |
261 | 200 |
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
201 # 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:
262
diff
changeset
|
202 # Cluster is superset of Enterprise/GPL so it gets highest priority. |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
203 # And use only one. |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
204 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:
262
diff
changeset
|
205 if [ -d "${mydir}" ]; then |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
206 PATH="${mydir}:${PATH}" |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
207 break |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
208 fi |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
209 done |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
210 |
261 | 211 # 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:
262
diff
changeset
|
212 # And use only one. |
281
87ce8cfdb8d4
Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents:
279
diff
changeset
|
213 for hgdir in {"${HOME}/app","/opt"}/mercurial{,/bin}; do |
87ce8cfdb8d4
Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents:
279
diff
changeset
|
214 hgbin="${hgdir}/hg" |
87ce8cfdb8d4
Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents:
279
diff
changeset
|
215 if [ -x "${hgbin}" ]; then |
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
216 PATH="${PATH}:${hgdir}" |
281
87ce8cfdb8d4
Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents:
279
diff
changeset
|
217 alias nhg="${hgbin}" |
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
218 break |
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
219 fi |
261 | 220 done |
56
9343fa4dfd91
[bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents:
55
diff
changeset
|
221 |
273
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
222 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:
271
diff
changeset
|
223 if [ -d "${supbindir}" ]; then |
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
224 PATH="${PATH}:${supbindir}" |
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
225 break |
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
226 fi |
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
227 done |
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
228 |
436
d6ac822569c4
Updated the uncolored prompt style.
Edho Arief <edho@myconan.net>
parents:
435
diff
changeset
|
229 PS1='\u@\h:\w\$ ' |
59 | 230 case "${TERM}" in |
254
dde04581a2bf
Combined PS1 and PROMPT_COMMAND conditional.
Edho Arief <edho@myconan.net>
parents:
253
diff
changeset
|
231 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:
270
diff
changeset
|
232 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:
351
diff
changeset
|
233 # DragonFly's Bash is a bit buggy. |
038c28c748d0
The color prompt is broken-ish in DFBSD.
Edho Arief <edho@myconan.net>
parents:
351
diff
changeset
|
234 if [ "$(uname)" != "DragonFly" ]; then |
435
4a71d0b1a4c6
Different, more compact style of prompt.
Edho Arief <edho@myconan.net>
parents:
434
diff
changeset
|
235 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:
351
diff
changeset
|
236 fi |
59 | 237 ;; |
238 esac | |
239 | |
501 | 240 # Priority PATHs. Always enable. |
241 PATH="${HOME}/bin:${HOME}/.ecos_bin:/opt/local/bin:/opt/local/sbin:${PATH}" | |
242 | |
63
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
243 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:
62
diff
changeset
|
244 alias vi=vim |
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
245 export EDITOR=vim |
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
246 fi |
266 | 247 |
296 | 248 if command -v less > /dev/null 2>&1; then |
395
c01d272af466
Moved less configuration declaration to environment variable.
Edho Arief <edho@myconan.net>
parents:
360
diff
changeset
|
249 export PAGER=less |
488
e3648f0482e5
Automatically exit less when the file is less than one screenful.
edogawaconan <me@myconan.net>
parents:
477
diff
changeset
|
250 export LESS=-FMRXginsz-2 |
296 | 251 fi |
252 | |
365 | 253 # Test if we have GNU rm prefixed by g (esp if on non-GNU system). |
254 # Usually on old Solaris and {Net,Open,DragonFly}BSD. | |
255 if command -v grm > /dev/null 2>&1; then | |
256 _rm="grm" | |
257 else | |
258 _rm="rm" | |
259 fi | |
260 # Test if the specified rm has "-I" parameter since it's much better. | |
261 if "${_rm}" -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null; then | |
262 alias rm="${_rm} -I" | |
263 else | |
264 alias rm="${_rm} -i" | |
265 fi | |
366 | 266 unset _rm |
266 | 267 |
402
a23b0f6ee8a2
Add alias for zeropaste posting.
Edho Arief <edho@myconan.net>
parents:
400
diff
changeset
|
268 if command -v curl > /dev/null 2>&1; then |
465 | 269 alias 0p="gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[paste_gzip]=<-'" |
466 | 270 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:
400
diff
changeset
|
271 fi |
a23b0f6ee8a2
Add alias for zeropaste posting.
Edho Arief <edho@myconan.net>
parents:
400
diff
changeset
|
272 |
501 | 273 if command -v tmux > /dev/null 2>&1; then |
274 case "${_os}" in | |
275 OpenBSD) | |
276 # FIXME: OpenBSD version check | |
277 _tmux_conf_ver=1.9 | |
278 ;; | |
279 *) | |
514
13deb0e1a2cc
tmux 1.3 doesn't have -V parameter.
edogawaconan <me@myconan.net>
parents:
511
diff
changeset
|
280 case "$(tmux -V 2> /dev/null)" in |
501 | 281 "tmux 1."[1-9][0-9]*|"tmux 1.9"*) _tmux_conf_ver=1.9;; |
282 "tmux 1."[4-8]*) _tmux_conf_ver=1.4;; | |
283 *) _tmux_conf_ver=1.3;; | |
284 esac | |
285 ;; | |
286 esac | |
287 alias tmux="tmux -f '""${HOME}""/.tmux-""${_tmux_conf_ver}"".conf'" | |
288 unset _tmux_conf_ver | |
289 fi | |
290 | |
291 unset _os | |
464 | 292 |
71 | 293 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after" |