Mercurial > ec-dotfiles
annotate rc/bashrc @ 749:3cacb4270864 default tip
[bashrc] hg grep now does the expected thing, no need for custom alias
| author | nanaya <me@nanaya.net> |
|---|---|
| date | Tue, 02 Sep 2025 22:43:45 +0900 |
| parents | 47da3cb3eafa |
| children |
| 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 |
|
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 | 16 _org_path="${PATH}" |
| 386 | 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 | 27 set +H |
| 28 | |
| 386 | 29 # Basic PATH |
| 468 | 30 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games" |
| 385 | 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 | 34 # pkgsrc |
| 35 if test -d /usr/pkg; then | |
| 36 PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin" | |
| 37 if test -d /usr/pkg/java/openjdk7; then | |
| 38 # OpenJDK 7 in pkgsrc | |
| 39 PATH="${PATH}:/usr/pkg/java/openjdk7/bin" | |
| 40 fi | |
| 41 fi | |
| 460 | 42 |
| 387 | 43 # OpenBSD X11 |
| 44 test -d /usr/X11R6/bin && PATH="${PATH}:/usr/X11R6/bin" | |
| 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 | 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 | 50 |
| 439 | 51 # PostgreSQL EnterpriseDB |
| 52 # Defaults to last version available. | |
| 521 | 53 for _pgbindir in /opt/PostgreSQL/*/bin; do test; done |
| 439 | 54 test -d "${_pgbindir}" && PATH="${_pgbindir}:${PATH}" |
| 55 unset _pgbindir | |
| 56 | |
| 372 | 57 # Nuke currently defined functions |
| 396 | 58 unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1) |
| 372 | 59 |
| 374 | 60 # Nuke bash-completion |
| 61 complete -r | |
| 62 | |
| 380 | 63 # Nuke aliases |
| 64 unalias -a | |
| 65 | |
|
111
fd8dbd4bb758
ls color for freebsd, history control.
Edho Prima Arief <edho@myconan.net>
parents:
106
diff
changeset
|
66 shopt -s histappend |
| 499 | 67 HISTSIZE=20000 |
| 68 HISTFILESIZE=$HISTSIZE | |
| 69 HISTCONTROL=ignorespace:ignoredups:erasedups | |
| 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 | 72 export PAGER=more |
| 73 export EDITOR=vi | |
|
747
47da3cb3eafa
[bashrc] C.UTF-8 seems pretty common now
nanaya <me@nanaya.net>
parents:
738
diff
changeset
|
74 export LANG="C.UTF-8" |
|
47da3cb3eafa
[bashrc] C.UTF-8 seems pretty common now
nanaya <me@nanaya.net>
parents:
738
diff
changeset
|
75 export LC_ALL="C.UTF-8" |
|
267
e35a36bb832e
Always export LSCOLORS and CLICOLOR
Edho Arief <edho@myconan.net>
parents:
266
diff
changeset
|
76 export CLICOLOR= |
|
342
4a37643931c4
[rc/bashrc] Better color for solarized and general (blue -> cyan).
Edho Arief <edho@myconan.net>
parents:
335
diff
changeset
|
77 export LSCOLORS="gxfxcxdxbxegedabagacad" |
| 307 | 78 export LS_COLORS= |
|
309
592605e4d3bb
Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents:
308
diff
changeset
|
79 export BLOCKSIZE=1K |
|
592605e4d3bb
Use SI whenever possible. Use 1KiB instead otherwise.
Edho Arief <edho@myconan.net>
parents:
308
diff
changeset
|
80 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
|
81 |
| 62 | 82 alias ls="ls -F" |
| 288 | 83 alias rd="rdesktop -g 1280x600 -K -a 15 -x m -z -P -r sound:off -r clipboard:CLIPBOARD -5" |
| 477 | 84 alias be="bundle exec" |
| 85 alias ll="ls -l" | |
| 86 alias la="ls -A" | |
| 712 | 87 alias htop="TERM=xterm htop -M" |
|
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
88 |
| 43 | 89 _has_gnu_ls= |
|
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
90 _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
|
91 _ls="ls" |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
92 _grep="grep" |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
93 _has_posix_grep=y |
|
691
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
94 _uid=$(id -u) |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
95 |
| 501 | 96 case "${_os}" in |
| 43 | 97 Linux) |
| 98 _has_gnu_ls=y | |
|
96
26c9dc482051
Merge. Linux obviously has gnu grep.
Edho Prima Arief <edho@myconan.net>
parents:
75
diff
changeset
|
99 _has_gnu_grep=y |
| 43 | 100 ;; |
| 101 SunOS) | |
| 714 | 102 if [ -f /usr/share/lib/terminfo/s/screen ]; then |
| 103 export TERMINFO=/usr/share/lib/terminfo | |
| 104 elif [ -f /opt/csw/share/terminfo/s/screen ]; then | |
| 105 export TERMINFO=/opt/csw/share/terminfo | |
| 106 else | |
| 107 unset TERMINFO | |
| 108 export TERM=dtterm | |
| 109 fi | |
| 110 | |
| 111 [ xterm = "${TERM}" ] && export TERM=xterm-256color | |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
112 _has_posix_grep=n |
| 43 | 113 [ -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
|
114 [ -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
|
115 # Higher priority directories |
|
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
116 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
|
117 [ -d "${i}" ] && PATH="${i}:${PATH}" |
|
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
118 done |
|
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
119 for i in /usr/{sfw,xpg4}/bin; do |
|
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
120 [ -d "${i}" ] && PATH="${PATH}:${i}" |
|
e6de49d70fe7
(Not so) simplified solaris path add.
Edho Arief <edho@myconan.net>
parents:
252
diff
changeset
|
121 done |
|
333
aeb51856e281
[rc/bash] Solaris: additional path, removed useless test.
Edho Arief <edho@myconan.net>
parents:
326
diff
changeset
|
122 [ -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
|
123 [ -d "/opt/local/sbin" ] && PATH="/opt/local/sbin:${PATH}" |
|
ce21ebae61b4
Add /opt/local beforehand in sunos.
edogawaconan <me@myconan.net>
parents:
510
diff
changeset
|
124 [ -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
|
125 alias ping="ping -s" |
|
ada5b9534765
[bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents:
56
diff
changeset
|
126 alias ping6="ping -A inet6" |
| 43 | 127 ;; |
| 275 | 128 FreeBSD) |
| 278 | 129 # Multi CPU awesomeness. |
| 130 alias top="top -P" | |
|
697
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
131 # The grep isn't GNU grep but supports all of its commands |
|
453
c3bfb45757e9
FreeBSD grep is GNU grep. Well, up to 9.x.
Edho Arief <edho@myconan.net>
parents:
440
diff
changeset
|
132 _has_gnu_grep=y |
| 275 | 133 ;; |
|
351
001cdf389aaf
NetBSD and DFBSD use similar package directory structure (pkgsrc).
Edho Arief <edho@myconan.net>
parents:
345
diff
changeset
|
134 NetBSD|DragonFly) |
|
697
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
135 # The grep isn't GNU grep but supports all of its commands |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
136 _has_gnu_grep=y |
| 249 | 137 ;; |
| 67 | 138 CYGWIN*) |
| 139 export PATH="${PATH}:${_org_path}" | |
| 140 ;; | |
| 581 | 141 MSYS_NT-*) |
| 142 _has_gnu_ls=y | |
| 143 export PATH="${PATH}:${_org_path}" | |
| 144 ;; | |
| 43 | 145 esac |
| 146 | |
|
697
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
147 if command -v gls > /dev/null 2>&1; then |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
148 _has_gnu_ls=y |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
149 _ls="gls" |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
150 elif command -v colorls > /dev/null 2>&1; then |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
151 alias ls="colorls -F" |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
152 fi |
|
7359a8dbab5c
[bashrc] Simplify grep check and unify ls check
nanaya <me@nanaya.pro>
parents:
696
diff
changeset
|
153 |
| 696 | 154 if command -v ggrep > /dev/null 2>&1; then |
| 155 _has_gnu_grep=y | |
| 156 _grep="ggrep" | |
| 157 fi | |
| 158 | |
| 314 | 159 if [ "${_has_gnu_ls}" = y ]; then |
|
691
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
160 _root_opt="" |
|
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
161 if [ "${_uid}" = "0" ]; then |
|
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
162 _root_opt=" -A" |
|
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
163 fi |
|
698
8c2ba562b15a
[bashrc] group directories first if using gnu ls
nanaya <me@nanaya.pro>
parents:
697
diff
changeset
|
164 alias ls="${_ls}${_root_opt} -F --color=auto --group-directories-first" |
| 703 | 165 unset _root_opt |
|
516
6ef4bbc171eb
Revert to default LS_COLORS. From ubuntu 14.04.
edogawaconan <me@myconan.net>
parents:
514
diff
changeset
|
166 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 | 167 export LS_COLORS |
| 168 fi | |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
169 if [ "${_has_gnu_grep}" = y ]; then |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
170 alias grep="${_grep} --color=auto" |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
171 _has_posix_grep=y |
|
523
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
172 |
|
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
173 alias cgrep="${_grep} --color=always" |
|
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
174 alias cegrep="cgrep -E" |
|
b88f621b6bd8
Add always-colored grep aliases.
edogawaconan <me@myconan.net>
parents:
521
diff
changeset
|
175 alias cfgrep="cgrep -F" |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
176 fi |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
177 if [ "${_has_posix_grep}" = y ]; then |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
178 alias fgrep="grep -F" |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
179 alias egrep="grep -E" |
|
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
180 fi |
|
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
181 |
|
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
182 unset _has_gnu_ls |
| 58 | 183 unset _has_gnu_grep |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
184 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
|
185 unset _ls |
|
270
0e41725e7d38
Grep, GNU Grep, Solaris Grep, etc.
Edho Arief <edho@myconan.net>
parents:
269
diff
changeset
|
186 unset _grep |
|
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
187 |
| 261 | 188 # Custom application I usually install and safe to prioritize |
| 573 | 189 for i in {"${HOME}/apps","/opt"{,"/${USER:-$LOGNAME}"}}/{tmux,ruby19,python26,node,tarsnap,symon,nginx,p7zip,composer}/{bin,sbin}; do |
| 261 | 190 [ -d "${i}" ] && PATH="${i}:${PATH}" |
| 191 done | |
| 304 | 192 # New(?) rubygems bin PATH |
| 543 | 193 for i in {"${HOME}/apps","/opt"{,"/${USER:-$LOGNAME}"}}/ruby19/lib/ruby/gems/1.9.1/bin; do |
| 304 | 194 [ -d "${i}" ] && PATH="${i}:${PATH}" |
| 195 done | |
| 261 | 196 |
|
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
197 # 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
|
198 # 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
|
199 # And use only one. |
| 703 | 200 for i in {"${HOME}",/apps,/opt}/mysql/{{cluster,enterprise}/mysql/,}bin; do |
| 201 if [ -d "${i}" ]; then | |
| 202 PATH="${i}:${PATH}" | |
|
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
203 break |
|
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
204 fi |
|
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
205 done |
|
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
206 |
| 261 | 207 # 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
|
208 # And use only one. |
| 703 | 209 for i in {"${HOME}/apps","/opt"}/mercurial{,/bin}; do |
| 210 _hgbin="${i}/hg" | |
| 211 if [ -x "${_hgbin}" ]; then | |
|
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
212 PATH="${PATH}:${hgdir}" |
| 703 | 213 alias nhg="${_hgbin}" |
|
264
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
214 break |
|
c6c322c57e0e
Paths for MySQL, instabreak for mercurial.
Edho Arief <edho@myconan.net>
parents:
262
diff
changeset
|
215 fi |
| 261 | 216 done |
| 703 | 217 unset _hgbin |
|
56
9343fa4dfd91
[bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents:
55
diff
changeset
|
218 |
| 703 | 219 for i in {"${HOME}/apps","/opt"}/supervisor{,d}/bin; do |
| 220 if [ -d "${i}" ]; then | |
| 221 PATH="${PATH}:${i}" | |
|
273
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
222 break |
|
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
223 fi |
|
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
224 done |
|
cf23a637f3a5
Supervisor support. Added on last since I usually install it in virtualenv
Edho Arief <edho@myconan.net>
parents:
271
diff
changeset
|
225 |
|
436
d6ac822569c4
Updated the uncolored prompt style.
Edho Arief <edho@myconan.net>
parents:
435
diff
changeset
|
226 PS1='\u@\h:\w\$ ' |
| 59 | 227 case "${TERM}" in |
| 683 | 228 xterm*|screen*|dtterm*|tmux*) |
|
584
4130d41c6acb
Support for msys' USERNAME variable
nanaya <me@myconan.net>
parents:
582
diff
changeset
|
229 PROMPT_COMMAND='echo -ne "\033]0;'"${USER:-${LOGNAME:-$USERNAME}}@$(uname -n)"': ${PWD}\007";'"${PROMPT_COMMAND}" |
|
691
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
230 if [ "${_uid}" = "0" ]; then |
| 530 | 231 PS1='\[\e[1;31m\]\u@\h:\w\$\[\e[0m\] ' |
|
694
92c1a021e8a1
[bashrc] Let's just assume it's been fixed in dfbsd
nanaya <me@nanaya.pro>
parents:
693
diff
changeset
|
232 else |
|
435
4a71d0b1a4c6
Different, more compact style of prompt.
Edho Arief <edho@myconan.net>
parents:
434
diff
changeset
|
233 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
|
234 fi |
| 59 | 235 ;; |
| 236 esac | |
| 237 | |
| 501 | 238 # Priority PATHs. Always enable. |
|
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
530
diff
changeset
|
239 PATH="${HOME}/bin:${HOME}/.ec.bin:/opt/local/bin:/opt/local/sbin:${PATH}" |
| 501 | 240 |
|
63
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
241 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
|
242 alias vi=vim |
|
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
243 export EDITOR=vim |
|
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
244 fi |
| 266 | 245 |
| 296 | 246 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
|
247 export PAGER=less |
|
488
e3648f0482e5
Automatically exit less when the file is less than one screenful.
edogawaconan <me@myconan.net>
parents:
477
diff
changeset
|
248 export LESS=-FMRXginsz-2 |
| 296 | 249 fi |
| 250 | |
| 365 | 251 # Test if we have GNU rm prefixed by g (esp if on non-GNU system). |
| 252 # Usually on old Solaris and {Net,Open,DragonFly}BSD. | |
| 253 if command -v grm > /dev/null 2>&1; then | |
| 254 _rm="grm" | |
| 255 else | |
| 256 _rm="rm" | |
| 257 fi | |
| 258 # Test if the specified rm has "-I" parameter since it's much better. | |
|
695
26568ef0d05a
[bashrc] Use bash internal random variable
nanaya <me@nanaya.pro>
parents:
694
diff
changeset
|
259 if "${_rm}" -If "/tmp/.nonexistent.${RANDOM}" 2> /dev/null; then |
| 365 | 260 alias rm="${_rm} -I" |
| 261 else | |
| 262 alias rm="${_rm} -i" | |
| 263 fi | |
| 366 | 264 unset _rm |
| 266 | 265 |
|
738
687d9ee4a5c9
[bashrc] Skip curl check for 0paste aliases
nanaya <me@nanaya.net>
parents:
737
diff
changeset
|
266 alias 0p="gzip | curl 'https://paste.myconan.net/pastes.txt' -F 'paste[paste_gzip]=@-'" |
|
687d9ee4a5c9
[bashrc] Skip curl check for 0paste aliases
nanaya <me@nanaya.net>
parents:
737
diff
changeset
|
267 alias 0pp="gzip | curl 'https://paste.myconan.net/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
|
268 |
| 501 | 269 unset _os |
|
691
7dda86be7a60
[bashrc] Support -A with gnu ls root
nanaya <me@nanaya.pro>
parents:
683
diff
changeset
|
270 unset _uid |
| 703 | 271 unset i |
| 464 | 272 |
| 654 | 273 # reset cursor shape |
| 274 # reference: https://conemu.github.io/en/AnsiEscapeCodes.html#Terminal_modes | |
| 275 printf '\033[2 q' | |
| 276 | |
|
533
77c1f9e624a3
Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents:
530
diff
changeset
|
277 [ -f "${HOME}/.ec.bash.after" ] && . "${HOME}/.ec.bash.after" |
