annotate rc/bashrc @ 610:2f6b07f2ab94

RIP !! (history expansion)
author nanaya <me@nanaya.pro>
date Mon, 02 Apr 2018 17:33:57 +0900
parents 6114dccd8b75
children 84791ac85abd
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
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 530
diff changeset
8 if [ "${EC_BASH_LOADED}" != "yes" ]; then
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 530
diff changeset
9 EC_BASH_LOADED="yes"
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
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
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 530
diff changeset
14 [ -f "${HOME}/.ec.bash.before" ] && . "${HOME}/.ec.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
587
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
18 # ensure correct window size at all time
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
19 # noticeably in FreebSD + tmux + vim:
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
20 # 1. start tmux
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
21 # 2. start vim in the session
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
22 # 3. split pane
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
23 # 4. quit vim
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
24 # 5. wrong COLUMNS or LINES
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
25 shopt -s checkwinsize
394f19c180a2 Ensure correct terminal size variables
nanaya <me@myconan.net>
parents: 584
diff changeset
26
610
2f6b07f2ab94 RIP !! (history expansion)
nanaya <me@nanaya.pro>
parents: 593
diff changeset
27 set +H
2f6b07f2ab94 RIP !! (history expansion)
nanaya <me@nanaya.pro>
parents: 593
diff changeset
28
386
8438e85e1490 Added comment.
Edho Arief <edho@myconan.net>
parents: 385
diff changeset
29 # Basic PATH
468
ef65da81d2ee Add games to PATH.
Edho Arief <edho@myconan.net>
parents: 466
diff changeset
30 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games"
385
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
31
520
a60af1e859e4 set PATH before calling uname.
edogawaconan <me@myconan.net>
parents: 516
diff changeset
32 _os="$(uname -s)"
a60af1e859e4 set PATH before calling uname.
edogawaconan <me@myconan.net>
parents: 516
diff changeset
33
385
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
34 # pkgsrc
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
35 if test -d /usr/pkg; then
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
36 PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
37 if test -d /usr/pkg/java/openjdk7; then
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
38 # OpenJDK 7 in pkgsrc
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
39 PATH="${PATH}:/usr/pkg/java/openjdk7/bin"
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
40 fi
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
41 fi
460
95fc26810152 Add macports path.
Edho Arief <edho@myconan.net>
parents: 453
diff changeset
42
387
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
43 # OpenBSD X11
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
44 test -d /usr/X11R6/bin && PATH="${PATH}:/usr/X11R6/bin"
b25fff40927c More PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 386
diff changeset
45 # PostgreSQL Yum
440
abbdb936a36a Automated pgsql yum version detect.
Edho Arief <edho@myconan.net>
parents: 439
diff changeset
46 # Defaults to last version available.
521
fb2d37acca81 Reducing bashism.
edogawaconan <me@myconan.net>
parents: 520
diff changeset
47 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
48 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}"
abbdb936a36a Automated pgsql yum version detect.
Edho Arief <edho@myconan.net>
parents: 439
diff changeset
49 unset _pgbindir
385
3e6324183eb4 PATH adjustment.
Edho Arief <edho@myconan.net>
parents: 380
diff changeset
50
439
cb2d444253f4 Added enterprisedb postgres.
Edho Arief <edho@myconan.net>
parents: 438
diff changeset
51 # PostgreSQL EnterpriseDB
cb2d444253f4 Added enterprisedb postgres.
Edho Arief <edho@myconan.net>
parents: 438
diff changeset
52 # Defaults to last version available.
521
fb2d37acca81 Reducing bashism.
edogawaconan <me@myconan.net>
parents: 520
diff changeset
53 for _pgbindir in /opt/PostgreSQL/*/bin; do test; done
439
cb2d444253f4 Added enterprisedb postgres.
Edho Arief <edho@myconan.net>
parents: 438
diff changeset
54 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}"
cb2d444253f4 Added enterprisedb postgres.
Edho Arief <edho@myconan.net>
parents: 438
diff changeset
55 unset _pgbindir
cb2d444253f4 Added enterprisedb postgres.
Edho Arief <edho@myconan.net>
parents: 438
diff changeset
56
372
ad07799cf765 Nuke all custom functions.
Edho Arief <edho@myconan.net>
parents: 368
diff changeset
57 # Nuke currently defined functions
396
c555557692bc Uses grep instead of egrep
Edho Arief <edho@myconan.net>
parents: 387
diff changeset
58 unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1)
372
ad07799cf765 Nuke all custom functions.
Edho Arief <edho@myconan.net>
parents: 368
diff changeset
59
374
792b49cd912a Also nuke bash-completion.
Edho Arief <edho@myconan.net>
parents: 372
diff changeset
60 # Nuke bash-completion
792b49cd912a Also nuke bash-completion.
Edho Arief <edho@myconan.net>
parents: 372
diff changeset
61 complete -r
792b49cd912a Also nuke bash-completion.
Edho Arief <edho@myconan.net>
parents: 372
diff changeset
62
380
7ceaf3cd8eea Unalias everything first.
Edho Arief <edho@myconan.net>
parents: 374
diff changeset
63 # Nuke aliases
7ceaf3cd8eea Unalias everything first.
Edho Arief <edho@myconan.net>
parents: 374
diff changeset
64 unalias -a
7ceaf3cd8eea Unalias everything first.
Edho Arief <edho@myconan.net>
parents: 374
diff changeset
65
111
fd8dbd4bb758 ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents: 106
diff changeset
66 shopt -s histappend
499
3979f3a55d0a Readd history autosync.
edogawaconan <me@myconan.net>
parents: 498
diff changeset
67 HISTSIZE=20000
3979f3a55d0a Readd history autosync.
edogawaconan <me@myconan.net>
parents: 498
diff changeset
68 HISTFILESIZE=$HISTSIZE
3979f3a55d0a Readd history autosync.
edogawaconan <me@myconan.net>
parents: 498
diff changeset
69 HISTCONTROL=ignorespace:ignoredups:erasedups
3979f3a55d0a Readd history autosync.
edogawaconan <me@myconan.net>
parents: 498
diff changeset
70 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
71
414
69f30c512242 Less quotes.
Edho Arief <edho@myconan.net>
parents: 413
diff changeset
72 export PAGER=more
69f30c512242 Less quotes.
Edho Arief <edho@myconan.net>
parents: 413
diff changeset
73 export EDITOR=vi
89
29bd7f6ef58a Explicit LANG declaration.
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
74 export LANG="en_US.UTF-8"
461
012baf74024c Also enfore LC_CTYPE.
Edho Arief <edho@myconan.net>
parents: 460
diff changeset
75 export LC_CTYPE="en_US.UTF-8"
355
8fcb3f1553cf Default LC_COLLATE to C.
Edho Arief <edho@myconan.net>
parents: 352
diff changeset
76 # The en_US.UTF-8 causes weird sorting.
8fcb3f1553cf Default LC_COLLATE to C.
Edho Arief <edho@myconan.net>
parents: 352
diff changeset
77 # (not really, but I prefer C based sort.)
414
69f30c512242 Less quotes.
Edho Arief <edho@myconan.net>
parents: 413
diff changeset
78 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
79 export LC_MESSAGES=C
267
e35a36bb832e Always export LSCOLORS and CLICOLOR
Edho Arief <edho@myconan.net>
parents: 266
diff changeset
80 export CLICOLOR=
342
4a37643931c4 [rc/bashrc] Better color for solarized and general (blue -> cyan).
Edho Arief <edho@myconan.net>
parents: 335
diff changeset
81 export LSCOLORS="gxfxcxdxbxegedabagacad"
307
81bfcb3015bd Reset LS_COLORS by default.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
82 export LS_COLORS=
309
592605e4d3bb Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents: 308
diff changeset
83 export BLOCKSIZE=1K
592605e4d3bb Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents: 308
diff changeset
84 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
85
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
86 alias ls="ls -F"
288
5fbe9461efea Faster rdesktop.
Edho Arief <edho@myconan.net>
parents: 281
diff changeset
87 alias rd="rdesktop -g 1280x600 -K -a 15 -x m -z -P -r sound:off -r clipboard:CLIPBOARD -5"
593
6114dccd8b75 BETTER MAN
nanaya <me@myconan.net>
parents: 592
diff changeset
88 alias man="LANG=C LC_ALL=C LC_CTYPE=C man"
477
be8a91c2fd64 More aliases.
edogawaconan <me@myconan.net>
parents: 468
diff changeset
89 alias be="bundle exec"
be8a91c2fd64 More aliases.
edogawaconan <me@myconan.net>
parents: 468
diff changeset
90 alias ll="ls -l"
be8a91c2fd64 More aliases.
edogawaconan <me@myconan.net>
parents: 468
diff changeset
91 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
92
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
93 _has_gnu_ls=
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
94 _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
95 _ls="ls"
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
96 _grep="grep"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
97 _has_posix_grep=y
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
98
506
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
99 if [ SunOS = "${_os}" ]; then
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
100 if [ -f /usr/share/lib/terminfo/s/screen ]; then
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
101 export TERMINFO=/usr/share/lib/terminfo
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
102 elif [ -f /opt/csw/share/terminfo/s/screen ]; then
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
103 export TERMINFO=/opt/csw/share/terminfo
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
104 else
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
105 unset TERMINFO
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
106 export TERM=dtterm
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
107 fi
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
108
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
109 [ xterm = "${TERM}" ] && export TERM=xterm-256color
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
110 fi
84ad2517ac90 Refactor terminal-relatd detection in sunos.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
111
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
112 case "${_os}" in
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
113 Linux)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
114 _has_gnu_ls=y
96
26c9dc482051 Merge. Linux obviously has gnu grep.
Edho Prima Arief <edho@myconan.net>
parents: 75
diff changeset
115 _has_gnu_grep=y
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
116 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
117 SunOS)
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
118 _has_posix_grep=n
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
119 [ -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
120 [ -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
121 # Higher priority directories
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
122 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
123 [ -d "${i}" ] && PATH="${i}:${PATH}"
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
124 done
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
125 for i in /usr/{sfw,xpg4}/bin; do
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
126 [ -d "${i}" ] && PATH="${PATH}:${i}"
e6de49d70fe7 (Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents: 252
diff changeset
127 done
333
aeb51856e281 [rc/bash] Solaris: additional path, removed useless test.
Edho Arief <edho@myconan.net>
parents: 326
diff changeset
128 [ -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
129 [ -d "/opt/local/sbin" ] && PATH="/opt/local/sbin:${PATH}"
ce21ebae61b4 Add /opt/local beforehand in sunos.
edogawaconan <me@myconan.net>
parents: 510
diff changeset
130 [ -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
131 alias ping="ping -s"
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
132 alias ping6="ping -A inet6"
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
133 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
134 _has_gnu_grep=y
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
135 _grep="ggrep"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
136 fi
272
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
137 if command -v gls > /dev/null 2>&1; then
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
138 _has_gnu_ls=y
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
139 _ls="gls"
53bbc9673f87 Check GNU ls on Solaris.
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
140 fi
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
141 ;;
275
a2f0f4106c00 alias man for FreeBSD.
Edho Arief <edho@myconan.net>
parents: 273
diff changeset
142 FreeBSD)
278
8e451b27baa5 Multi CPU Top on FreeBSD.
Edho Arief <edho@myconan.net>
parents: 276
diff changeset
143 # Multi CPU awesomeness.
8e451b27baa5 Multi CPU Top on FreeBSD.
Edho Arief <edho@myconan.net>
parents: 276
diff changeset
144 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
145 # 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
146 _has_gnu_grep=y
275
a2f0f4106c00 alias man for FreeBSD.
Edho Arief <edho@myconan.net>
parents: 273
diff changeset
147 ;;
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
148 OpenBSD)
407
e5739479dc53 Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents: 403
diff changeset
149 # GNU ls is broken in 5.2. Prioritize colorls instead.
e5739479dc53 Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents: 403
diff changeset
150 if command -v colorls > /dev/null 2>&1; then
e5739479dc53 Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents: 403
diff changeset
151 alias ls="colorls -F"
e5739479dc53 Prioritize colorls in openbsd.
Edho Arief <edho@myconan.net>
parents: 403
diff changeset
152 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
153 _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
154 _ls="gls"
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
155 fi
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
156 ;;
351
001cdf389aaf NetBSD and DFBSD use similar package directory structure (pkgsrc).
Edho Arief <edho@myconan.net>
parents: 345
diff changeset
157 NetBSD|DragonFly)
249
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
158 if command -v gls > /dev/null 2>&1; then
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
159 _has_gnu_ls=y
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
160 _ls="gls"
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
161 elif command -v colorls > /dev/null 2>&1; then
276
Edho Arief <edho@myconan.net>
parents: 275
diff changeset
162 alias ls="colorls -F"
249
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
163 fi
367
37e422bb903b Grep in color for NetBSD/DragonFly.
Edho Arief <edho@myconan.net>
parents: 366
diff changeset
164 alias grep='grep --color=auto'
249
68b765e9cf76 Some support for netbsd.
Edho Arief <edho@myconan.net>
parents: 247
diff changeset
165 ;;
67
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
166 CYGWIN*)
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
167 export PATH="${PATH}:${_org_path}"
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
168 ;;
581
b3c05c6be28d Add support for msys shell
nanaya <me@myconan.net>
parents: 576
diff changeset
169 MSYS_NT-*)
b3c05c6be28d Add support for msys shell
nanaya <me@myconan.net>
parents: 576
diff changeset
170 _has_gnu_ls=y
b3c05c6be28d Add support for msys shell
nanaya <me@myconan.net>
parents: 576
diff changeset
171 export PATH="${PATH}:${_org_path}"
b3c05c6be28d Add support for msys shell
nanaya <me@myconan.net>
parents: 576
diff changeset
172 ;;
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
173 esac
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
174
314
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
175 if [ "${_has_gnu_ls}" = y ]; then
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
176 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
177 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
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
178 export LS_COLORS
30ccb356a94a Solarized ls colors!
Edho Arief <edho@myconan.net>
parents: 309
diff changeset
179 fi
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
180 if [ "${_has_gnu_grep}" = y ]; then
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
181 alias grep="${_grep} --color=auto"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
182 _has_posix_grep=y
523
b88f621b6bd8 Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents: 521
diff changeset
183
b88f621b6bd8 Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents: 521
diff changeset
184 alias cgrep="${_grep} --color=always"
b88f621b6bd8 Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents: 521
diff changeset
185 alias cegrep="cgrep -E"
b88f621b6bd8 Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents: 521
diff changeset
186 alias cfgrep="cgrep -F"
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
187 fi
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
188 if [ "${_has_posix_grep}" = y ]; then
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
189 alias fgrep="grep -F"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
190 alias egrep="grep -E"
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
191 fi
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
192
524
51a60cc44880 Add hggrep to grep hg repo.
edogawaconan <me@myconan.net>
parents: 523
diff changeset
193 # FIXME: missing test for hg and xargs -0
51a60cc44880 Add hggrep to grep hg repo.
edogawaconan <me@myconan.net>
parents: 523
diff changeset
194 _xargs_grep="${_grep}"
51a60cc44880 Add hggrep to grep hg repo.
edogawaconan <me@myconan.net>
parents: 523
diff changeset
195 [ "${_has_gnu_grep}" = y ] && _xargs_grep="${_grep} --color=always"
51a60cc44880 Add hggrep to grep hg repo.
edogawaconan <me@myconan.net>
parents: 523
diff changeset
196 alias hggrep="hg locate -0 | xargs -0 ${_xargs_grep}"
51a60cc44880 Add hggrep to grep hg repo.
edogawaconan <me@myconan.net>
parents: 523
diff changeset
197 unset _xargs_grep
51a60cc44880 Add hggrep to grep hg repo.
edogawaconan <me@myconan.net>
parents: 523
diff changeset
198
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
199 unset _has_gnu_ls
58
73b2fccc4f06 [bash] missed unset.
Edho Prima Arief <me@myconan.net>
parents: 57
diff changeset
200 unset _has_gnu_grep
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
201 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
202 unset _ls
270
0e41725e7d38 Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents: 269
diff changeset
203 unset _grep
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
204
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
205 # Custom application I usually install and safe to prioritize
573
ee234e4c144d Add composer to default tools.
nanaya <me@myconan.net>
parents: 567
diff changeset
206 for i in {"${HOME}/apps","/opt"{,"/${USER:-$LOGNAME}"}}/{tmux,ruby19,python26,node,tarsnap,symon,nginx,p7zip,composer}/{bin,sbin}; do
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
207 [ -d "${i}" ] && PATH="${i}:${PATH}"
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
208 done
304
73981a7539dd New rubygems path.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
209 # New(?) rubygems bin PATH
543
8b884bbb1d05 Rename `app` to `apps`.
edogawaconan <me@myconan.net>
parents: 533
diff changeset
210 for i in {"${HOME}/apps","/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
211 [ -d "${i}" ] && PATH="${i}:${PATH}"
73981a7539dd New rubygems path.
Edho Arief <edho@myconan.net>
parents: 296
diff changeset
212 done
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
213
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
214 # 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
215 # 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
216 # And use only one.
543
8b884bbb1d05 Rename `app` to `apps`.
edogawaconan <me@myconan.net>
parents: 533
diff changeset
217 for mydir in {"${HOME}",/apps,/opt}/mysql/{{cluster,enterprise}/mysql/,}bin; do
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
218 if [ -d "${mydir}" ]; then
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
219 PATH="${mydir}:${PATH}"
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
220 break
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
221 fi
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
222 done
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
223
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
224 # 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
225 # And use only one.
543
8b884bbb1d05 Rename `app` to `apps`.
edogawaconan <me@myconan.net>
parents: 533
diff changeset
226 for hgdir in {"${HOME}/apps","/opt"}/mercurial{,/bin}; do
281
87ce8cfdb8d4 Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
227 hgbin="${hgdir}/hg"
87ce8cfdb8d4 Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
228 if [ -x "${hgbin}" ]; then
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
229 PATH="${PATH}:${hgdir}"
281
87ce8cfdb8d4 Alias for newer hg. Also more search path.
Edho Arief <edho@myconan.net>
parents: 279
diff changeset
230 alias nhg="${hgbin}"
264
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
231 break
c6c322c57e0e Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents: 262
diff changeset
232 fi
261
00ecebc73c73 Path rearrange.
Edho Arief <edho@myconan.net>
parents: 260
diff changeset
233 done
56
9343fa4dfd91 [bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents: 55
diff changeset
234
543
8b884bbb1d05 Rename `app` to `apps`.
edogawaconan <me@myconan.net>
parents: 533
diff changeset
235 for supbindir in {"${HOME}/apps","/opt"}/supervisor{,d}/bin; do
273
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
236 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
237 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
238 break
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
239 fi
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
240 done
cf23a637f3a5 Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents: 271
diff changeset
241
436
d6ac822569c4 Updated the uncolored prompt style.
Edho Arief <edho@myconan.net>
parents: 435
diff changeset
242 PS1='\u@\h:\w\$ '
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
243 case "${TERM}" in
254
dde04581a2bf Combined PS1 and PROMPT_COMMAND conditional.
Edho Arief <edho@myconan.net>
parents: 253
diff changeset
244 xterm*|screen*|dtterm*)
584
4130d41c6acb Support for msys' USERNAME variable
nanaya <me@myconan.net>
parents: 582
diff changeset
245 PROMPT_COMMAND='echo -ne "\033]0;'"${USER:-${LOGNAME:-$USERNAME}}@$(uname -n)"': ${PWD}\007";'"${PROMPT_COMMAND}"
530
0ab0820fd528 Red-colored prompt for root?
edogawaconan <me@myconan.net>
parents: 524
diff changeset
246 if [ "$(id -u)" = "0" ]; then
0ab0820fd528 Red-colored prompt for root?
edogawaconan <me@myconan.net>
parents: 524
diff changeset
247 PS1='\[\e[1;31m\]\u@\h:\w\$\[\e[0m\] '
0ab0820fd528 Red-colored prompt for root?
edogawaconan <me@myconan.net>
parents: 524
diff changeset
248 elif [ "$(uname)" != "DragonFly" ]; then
0ab0820fd528 Red-colored prompt for root?
edogawaconan <me@myconan.net>
parents: 524
diff changeset
249 # DragonFly's Bash is a bit buggy.
435
4a71d0b1a4c6 Different, more compact style of prompt.
Edho Arief <edho@myconan.net>
parents: 434
diff changeset
250 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
251 fi
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
252 ;;
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
253 esac
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
254
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
255 # Priority PATHs. Always enable.
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 530
diff changeset
256 PATH="${HOME}/bin:${HOME}/.ec.bin:/opt/local/bin:/opt/local/sbin:${PATH}"
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
257
63
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
258 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
259 alias vi=vim
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
260 export EDITOR=vim
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
261 fi
266
69b9cbf9f3c0 rm -I saner test.
Edho Arief <edho@myconan.net>
parents: 264
diff changeset
262
296
7251d4f5e5c9 Ensure we have less.
Edho Arief <edho@myconan.net>
parents: 288
diff changeset
263 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
264 export PAGER=less
488
e3648f0482e5 Automatically exit less when the file is less than one screenful.
edogawaconan <me@myconan.net>
parents: 477
diff changeset
265 export LESS=-FMRXginsz-2
296
7251d4f5e5c9 Ensure we have less.
Edho Arief <edho@myconan.net>
parents: 288
diff changeset
266 fi
7251d4f5e5c9 Ensure we have less.
Edho Arief <edho@myconan.net>
parents: 288
diff changeset
267
365
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
268 # 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
269 # Usually on old Solaris and {Net,Open,DragonFly}BSD.
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
270 if command -v grm > /dev/null 2>&1; then
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
271 _rm="grm"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
272 else
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
273 _rm="rm"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
274 fi
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
275 # 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
276 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
277 alias rm="${_rm} -I"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
278 else
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
279 alias rm="${_rm} -i"
3e62b13e1f48 Better test for rm aliasing
Edho Arief <edho@myconan.net>
parents: 360
diff changeset
280 fi
366
f615b9564fce Unset the test variable.
Edho Arief <edho@myconan.net>
parents: 365
diff changeset
281 unset _rm
266
69b9cbf9f3c0 rm -I saner test.
Edho Arief <edho@myconan.net>
parents: 264
diff changeset
282
402
a23b0f6ee8a2 Add alias for zeropaste posting.
Edho Arief <edho@myconan.net>
parents: 400
diff changeset
283 if command -v curl > /dev/null 2>&1; then
576
dd1f898432e3 Update 0paste domain
nanaya <me@myconan.net>
parents: 573
diff changeset
284 alias 0p="gzip | curl 'https://0paste.com/pastes.txt' -F 'paste[paste_gzip]=<-'"
dd1f898432e3 Update 0paste domain
nanaya <me@myconan.net>
parents: 573
diff changeset
285 alias 0pp="gzip | curl 'https://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
286 fi
a23b0f6ee8a2 Add alias for zeropaste posting.
Edho Arief <edho@myconan.net>
parents: 400
diff changeset
287
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
288 if command -v tmux > /dev/null 2>&1; then
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
289 case "${_os}" in
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
290 OpenBSD)
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
291 # FIXME: OpenBSD version check
592
902e74024e54 Update openbsd tmux version
nanaya <me@myconan.net>
parents: 591
diff changeset
292 _tmux_conf_ver=2.2
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
293 ;;
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
294 *)
514
13deb0e1a2cc tmux 1.3 doesn't have -V parameter.
edogawaconan <me@myconan.net>
parents: 511
diff changeset
295 case "$(tmux -V 2> /dev/null)" in
591
23e326f74bfd tmux point version only goes up to 9
nanaya <me@myconan.net>
parents: 590
diff changeset
296 "tmux 2."[2-9]|"tmux "[3-9]"."[0-9]|"tmux "[1-9][0-9][0.9]*"."[0-9]) _tmux_conf_ver=2.2;;
23e326f74bfd tmux point version only goes up to 9
nanaya <me@myconan.net>
parents: 590
diff changeset
297 "tmux 1.9"|"tmux 2."[0-1]) _tmux_conf_ver=1.9;;
559
fbf4507230e2 Improved tmux version detection?
nanaya <me@myconan.net>
parents: 546
diff changeset
298 "tmux 1."[4-8]) _tmux_conf_ver=1.4;;
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
299 *) _tmux_conf_ver=1.3;;
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
300 esac
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
301 ;;
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
302 esac
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
303 alias tmux="tmux -f '""${HOME}""/.tmux-""${_tmux_conf_ver}"".conf'"
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
304 unset _tmux_conf_ver
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
305 fi
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
306
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 499
diff changeset
307 unset _os
464
9c9aeccbdadf Resort prioritized paths.
Edho Arief <edho@myconan.net>
parents: 462
diff changeset
308
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 530
diff changeset
309 [ -f "${HOME}/.ec.bash.after" ] && . "${HOME}/.ec.bash.after"