annotate rc/bashrc @ 400:657f787fbae8

Merge remote-tracking branch 'origin/master'
author Edho Arief <edho@myconan.net>
date Tue, 04 Sep 2012 10:23:37 +0700
parents c01d272af466 c555557692bc
children a23b0f6ee8a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
1 #!/usr/bin/env bash
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
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
40236fd0a3a5 Explicit path checking.
Edho Prima Arief <me@myconan.net>
parents: 67
diff changeset
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
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
16 _org_path="${PATH}"
386
8438e85e1490 Added comment.
Edho Arief <edho@myconan.net>
parents: 385
diff changeset
17
8438e85e1490 Added comment.
Edho Arief <edho@myconan.net>
parents: 385
diff changeset
18 # Basic PATH
385
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
19 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
20
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
21 # pkgsrc
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
22 if test -d /usr/pkg; then
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
23 PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
24 if test -d /usr/pkg/java/openjdk7; then
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
25 # OpenJDK 7 in pkgsrc
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
26 PATH="${PATH}:/usr/pkg/java/openjdk7/bin"
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
27 fi
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
28 fi
387
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
29 # OpenBSD X11
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
30 test -d /usr/X11R6/bin && PATH="${PATH}:/usr/X11R6/bin"
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
31 # PostgreSQL Yum
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
32 test -d /usr/pgsql-8.4 && PATH="/usr/pgsql-8.4/bin:${PATH}"
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
33 test -d /usr/pgsql-9.1 && PATH="/usr/pgsql-9.1/bin:${PATH}"
385
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
34
372
ad07799cf765 Nuke all custom functions.
Edho Arief <edho@myconan.net>
parents: 368
diff changeset
35 # Nuke currently defined functions
396
c555557692bc Uses grep instead of egrep
Edho Arief <edho@myconan.net>
parents: 387
diff changeset
36 unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1)
372
ad07799cf765 Nuke all custom functions.
Edho Arief <edho@myconan.net>
parents: 368
diff changeset
37
374
792b49cd912a Also nuke bash-completion.
Edho Arief <edho@myconan.net>
parents: 372
diff changeset
38 # Nuke bash-completion
792b49cd912a Also nuke bash-completion.
Edho Arief <edho@myconan.net>
parents: 372
diff changeset
39 complete -r
792b49cd912a Also nuke bash-completion.
Edho Arief <edho@myconan.net>
parents: 372
diff changeset
40
380
7ceaf3cd8eea Unalias everything first.
Edho Arief <edho@myconan.net>
parents: 374
diff changeset
41 # Nuke aliases
7ceaf3cd8eea Unalias everything first.
Edho Arief <edho@myconan.net>
parents: 374
diff changeset
42 unalias -a
7ceaf3cd8eea Unalias everything first.
Edho Arief <edho@myconan.net>
parents: 374
diff changeset
43
111
fd8dbd4bb758 ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents: 106
diff changeset
44 shopt -s histappend
283
108e05eb9b5c Not just append but also read.
Edho Arief <edho@myconan.net>
parents: 282
diff changeset
45 PROMPT_COMMAND="history -a; history -n"
111
fd8dbd4bb758 ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents: 106
diff changeset
46 export HISTFILESIZE=10000
fd8dbd4bb758 ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents: 106
diff changeset
47 export HISTCONTROL=ignoredups
fd8dbd4bb758 ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents: 106
diff changeset
48
280
758dd58bb3cb Ensure less does actually exist. Default to more.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
49 export PAGER="more"
758dd58bb3cb Ensure less does actually exist. Default to more.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
50 export EDITOR="vi"
89
29bd7f6ef58a Explicit LANG declaration.
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
51 export LANG="en_US.UTF-8"
355
8fcb3f1553cf Default LC_COLLATE to C.
Edho Arief <edho@myconan.net>
parents: 352
diff changeset
52 # The en_US.UTF-8 causes weird sorting.
8fcb3f1553cf Default LC_COLLATE to C.
Edho Arief <edho@myconan.net>
parents: 352
diff changeset
53 # (not really, but I prefer C based sort.)
8fcb3f1553cf Default LC_COLLATE to C.
Edho Arief <edho@myconan.net>
parents: 352
diff changeset
54 export LC_COLLATE="C"
267
e35a36bb832e Always export LSCOLORS and CLICOLOR
Edho Arief <edho@myconan.net>
parents: 266
diff changeset
55 export CLICOLOR=
342
4a37643931c4 [rc/bashrc] Better color for solarized and general (blue -> cyan).
Edho Arief <edho@myconan.net>
parents: 335
diff changeset
56 export LSCOLORS="gxfxcxdxbxegedabagacad"
307
81bfcb3015bd Reset LS_COLORS by default.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
57 export LS_COLORS=
309
592605e4d3bb Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents: 308
diff changeset
58 export BLOCKSIZE=1K
592605e4d3bb Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents: 308
diff changeset
59 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
60
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
61 alias ls="ls -F"
288
5fbe9461efea Faster rdesktop.
Edho Arief <edho@myconan.net>
parents: 281
diff changeset
62 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
63 alias man="LANG=C man"
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
64
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
65 _has_gnu_ls=
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
66 _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
67 _ls="ls"
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
68 _grep="grep"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
69 _has_posix_grep=y
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
70
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
71 case "$(uname -s)" in
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
72 Linux)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
73 _has_gnu_ls=y
96
26c9dc482051 Merge. Linux obviously has gnu grep.
Edho Prima Arief <edho@myconan.net>
parents: 75
diff changeset
74 _has_gnu_grep=y
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
75 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
76 SunOS)
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
77 _has_posix_grep=n
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
78 [ -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
79 [ -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
80 # Higher priority directories
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
81 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
82 [ -d "${i}" ] && PATH="${i}:${PATH}"
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
83 done
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
84 for i in /usr/{sfw,xpg4}/bin; do
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
85 [ -d "${i}" ] && PATH="${PATH}:${i}"
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
86 done
333
aeb51856e281 [rc/bash] Solaris: additional path, removed useless test.
Edho Arief <edho@myconan.net>
parents: 326
diff changeset
87 [ -d "/opt/csw/gnu" ] && PATH="/opt/csw/gnu:${PATH}"
57
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
88 alias ping="ping -s"
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
89 alias ping6="ping -A inet6"
265
20ff9a9d11f0 tmux terminal for Solaris.
Edho Arief <edho@myconan.net>
parents: 264
diff changeset
90 # Hello tmux. Perhaps one day we'll have title with dtterm.
268
feab84a8efdb Merge. Also more workaround for Solaris tmux.
Edho Arief <edho@myconan.net>
parents: 265 267
diff changeset
91 # But for now we work this around by prepending tmux call with xterm-256color
feab84a8efdb Merge. Also more workaround for Solaris tmux.
Edho Arief <edho@myconan.net>
parents: 265 267
diff changeset
92 # which hopefully exists. Otherwise we have to live with no title.
326
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
93 case "${TERM}" in
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
94 xterm*)
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
95 if [ -f "/usr/share/lib/terminfo/x/xterm-256color" ]; then
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
96 export TERM="xterm-256color"
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
97 else
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
98 echo "No xterm-256color terminal, using dtterm. Tmux title won't work."
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
99 export TERM="dtterm"
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
100 fi
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
101 ;;
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
102 screen)
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
103 [ -f "/usr/share/lib/terminfo/s/screen" ] || export TERM="dtterm"
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
104 ;;
b27e43878127 [rc/bash] Better test for Solaris environment.
Edho Arief <edho@myconan.net>
parents: 320
diff changeset
105 esac
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
106 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
107 _has_gnu_grep=y
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
108 _grep="ggrep"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
109 fi
272
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
110 if command -v gls > /dev/null 2>&1; then
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
111 _has_gnu_ls=y
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
112 _ls="gls"
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
113 fi
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
114 ;;
275
a2f0f4106c00 alias man for FreeBSD.
Edho Arief <edho@myconan.net>
parents: 273
diff changeset
115 FreeBSD)
a2f0f4106c00 alias man for FreeBSD.
Edho Arief <edho@myconan.net>
parents: 273
diff changeset
116 # Invalid characters when using en_US.UTF-8.
a2f0f4106c00 alias man for FreeBSD.
Edho Arief <edho@myconan.net>
parents: 273
diff changeset
117 alias man="man -o"
278
8e451b27baa5 Multi CPU Top on FreeBSD.
Edho Arief <edho@myconan.net>
parents: 276
diff changeset
118 # Multi CPU awesomeness.
8e451b27baa5 Multi CPU Top on FreeBSD.
Edho Arief <edho@myconan.net>
parents: 276
diff changeset
119 alias top="top -P"
275
a2f0f4106c00 alias man for FreeBSD.
Edho Arief <edho@myconan.net>
parents: 273
diff changeset
120 ;;
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
121 OpenBSD)
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
122 if command -v gls > /dev/null 2>&1; then
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
123 _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
124 _ls="gls"
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
125 elif command -v colorls > /dev/null 2>&1; then
276
Edho Arief <edho@myconan.net>
parents: 275
diff changeset
126 alias ls="colorls -F"
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
127 fi
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
128 ;;
351
001cdf389aaf NetBSD and DFBSD use similar package directory structure (pkgsrc).
Edho Arief <edho@myconan.net>
parents: 345
diff changeset
129 NetBSD|DragonFly)
249
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
130 if command -v gls > /dev/null 2>&1; then
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
131 _has_gnu_ls=y
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
132 _ls="gls"
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
133 elif command -v colorls > /dev/null 2>&1; then
276
Edho Arief <edho@myconan.net>
parents: 275
diff changeset
134 alias ls="colorls -F"
249
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
135 fi
367
37e422bb903b Grep in color for NetBSD/DragonFly.
Edho Arief <edho@myconan.net>
parents: 366
diff changeset
136 alias grep='grep --color=auto'
249
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
137 ;;
67
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
138 CYGWIN*)
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
139 export PATH="${PATH}:${_org_path}"
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
140 ;;
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
141 esac
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
142
314
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
143 if [ "${_has_gnu_ls}" = y ]; then
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
144 alias ls="${_ls} -F --color=auto"
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
145 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:';
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
146 export LS_COLORS
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
147 fi
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
148 if [ "${_has_gnu_grep}" = y ]; then
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
149 alias grep="${_grep} --color=auto"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
150 _has_posix_grep=y
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
151 fi
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
152 if [ "${_has_posix_grep}" = y ]; then
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
153 alias fgrep="grep -F"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
154 alias egrep="grep -E"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
155 fi
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
156
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
157 unset _has_gnu_ls
58
73b2fccc4f06 [bash] missed unset.
Edho Prima Arief <me@myconan.net>
parents: 57
diff changeset
158 unset _has_gnu_grep
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
159 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
160 unset _ls
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
161 unset _grep
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
162
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
163 # Custom application I usually install and safe to prioritize
345
ea7214e4272b [rc/bashrc] Search for python26 in local dirs, too.
Edho Arief <edho@myconan.net>
parents: 344
diff changeset
164 for i in {"${HOME}/app","/opt"{,"/${USER:-$LOGNAME}"}}/{tmux,ruby19,python26,node,tarsnap,symon,nginx}/{bin,sbin}; do
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
165 [ -d "${i}" ] && PATH="${i}:${PATH}"
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
166 done
304
73981a7539dd New rubygems path.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
167 # New(?) rubygems bin PATH
344
759f9a63a497 Additional structure.
Edho Arief <edho@myconan.net>
parents: 342
diff changeset
168 for i in {"${HOME}/app","/opt"{,"/${USER:-$LOGNAME}"}}/ruby19/lib/ruby/gems/1.9.1/bin; do
304
73981a7539dd New rubygems path.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
169 [ -d "${i}" ] && PATH="${i}:${PATH}"
73981a7539dd New rubygems path.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
170 done
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
171
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
172 # 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
173 # 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
174 # And use only one.
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
175 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
176 if [ -d "${mydir}" ]; then
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
177 PATH="${mydir}:${PATH}"
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
178 break
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
179 fi
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
180 done
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
181
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
182 # 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
183 # And use only one.
281
87ce8cfdb8d4 Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
184 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
185 hgbin="${hgdir}/hg"
87ce8cfdb8d4 Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
186 if [ -x "${hgbin}" ]; then
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
187 PATH="${PATH}:${hgdir}"
281
87ce8cfdb8d4 Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
188 alias nhg="${hgbin}"
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
189 break
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
190 fi
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
191 done
56
9343fa4dfd91 [bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents: 55
diff changeset
192
273
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
193 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
194 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
195 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
196 break
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
197 fi
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
198 done
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
199
352
038c28c748d0 The color prompt is broken-ish in DFBSD.
Edho Arief <edho@myconan.net>
parents: 351
diff changeset
200 PS1='[\u@\h \W]\$ '
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
201 case "${TERM}" in
254
dde04581a2bf Combined PS1 and PROMPT_COMMAND conditional.
Edho Arief <edho@myconan.net>
parents: 253
diff changeset
202 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
203 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
204 # 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
205 if [ "$(uname)" != "DragonFly" ]; then
038c28c748d0 The color prompt is broken-ish in DFBSD.
Edho Arief <edho@myconan.net>
parents: 351
diff changeset
206 PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[0;36m\]\W\[\e[0m\]]\$ '
038c28c748d0 The color prompt is broken-ish in DFBSD.
Edho Arief <edho@myconan.net>
parents: 351
diff changeset
207 fi
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
208 ;;
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
209 esac
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
210
63
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
211 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
212 alias vi=vim
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
213 export EDITOR=vim
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
214 fi
266
69b9cbf9f3c0 rm -I saner test.
Edho Arief <edho@myconan.net>
parents: 264
diff changeset
215
296
7251d4f5e5c9 Ensure we have less.
Edho Arief <edho@myconan.net>
parents: 288
diff changeset
216 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
217 export PAGER=less
c01d272af466 Moved less configuration declaration to environment variable.
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
218 export LESS='-MRXgij15$nsz-2'
296
7251d4f5e5c9 Ensure we have less.
Edho Arief <edho@myconan.net>
parents: 288
diff changeset
219 fi
7251d4f5e5c9 Ensure we have less.
Edho Arief <edho@myconan.net>
parents: 288
diff changeset
220
365
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
221 # Test if we have GNU rm prefixed by g (esp if on non-GNU system).
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
222 # Usually on old Solaris and {Net,Open,DragonFly}BSD.
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
223 if command -v grm > /dev/null 2>&1; then
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
224 _rm="grm"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
225 else
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
226 _rm="rm"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
227 fi
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
228 # Test if the specified rm has "-I" parameter since it's much better.
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
229 if "${_rm}" -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null; then
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
230 alias rm="${_rm} -I"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
231 else
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
232 alias rm="${_rm} -i"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
233 fi
366
f615b9564fce Unset the test variable.
Edho Arief <edho@myconan.net>
parents: 365
diff changeset
234 unset _rm
266
69b9cbf9f3c0 rm -I saner test.
Edho Arief <edho@myconan.net>
parents: 264
diff changeset
235
71
40236fd0a3a5 Explicit path checking.
Edho Prima Arief <me@myconan.net>
parents: 67
diff changeset
236 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"