Mercurial > ec-dotfiles
annotate rc/bash @ 252:4fe8668e3ef0
Awesome custom paths by default.
| author | Edho Arief <edho@myconan.net> | 
|---|---|
| date | Mon, 14 Nov 2011 11:02:47 +0300 | 
| parents | 4a8d81743728 | 
| children | e6de49d70fe7 | 
| rev | line source | 
|---|---|
| 43 | 1 #!/usr/bin/env bash | 
| 2 | |
| 
242
 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 
Edho Arief <edho@myconan.net> 
parents: 
238 
diff
changeset
 | 
3 case "${-}" in | 
| 
 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 
Edho Arief <edho@myconan.net> 
parents: 
238 
diff
changeset
 | 
4 *i*) ;; | 
| 
 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 
Edho Arief <edho@myconan.net> 
parents: 
238 
diff
changeset
 | 
5 *) return;; | 
| 
 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 
Edho Arief <edho@myconan.net> 
parents: 
238 
diff
changeset
 | 
6 esac | 
| 
 
ebfa844d2ef8
[bash] Also ensures interactive terminal.
 
Edho Arief <edho@myconan.net> 
parents: 
238 
diff
changeset
 | 
7 | 
| 
117
 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
112 
diff
changeset
 | 
8 if [ "${ECOS_BASH_LOADED}" != "yes" ]; then | 
| 
122
 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
117 
diff
changeset
 | 
9 ECOS_BASH_LOADED="yes" | 
| 
 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
117 
diff
changeset
 | 
10 else | 
| 
 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
117 
diff
changeset
 | 
11 return | 
| 
 
eacc854eae67
Export should be used since it inherited to subshell (eg. tmux). Also hasten exit instead of fi on the bottom of file.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
117 
diff
changeset
 | 
12 fi | 
| 
117
 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
112 
diff
changeset
 | 
13 | 
| 71 | 14 [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before" | 
| 
49
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
15 | 
| 67 | 16 _org_path="${PATH}" | 
| 62 | 17 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" | 
| 
44
 
1f1af28f36e9
[bash] Bashrc, c-style ifdef.
 
Edho Prima Arief <me@myconan.net> 
parents: 
43 
diff
changeset
 | 
18 | 
| 
252
 
4fe8668e3ef0
Awesome custom paths by default.
 
Edho Arief <edho@myconan.net> 
parents: 
250 
diff
changeset
 | 
19 # Custom application I usually install and safe to prioritize | 
| 
 
4fe8668e3ef0
Awesome custom paths by default.
 
Edho Arief <edho@myconan.net> 
parents: 
250 
diff
changeset
 | 
20 for i in {"${HOME}/app","/opt"}/{tmux,ruby19,node,tarsnap,symon,nginx}/{bin,sbin}; do | 
| 
 
4fe8668e3ef0
Awesome custom paths by default.
 
Edho Arief <edho@myconan.net> 
parents: 
250 
diff
changeset
 | 
21 [ -d "${i}" ] && PATH="${i}:${PATH}" | 
| 
 
4fe8668e3ef0
Awesome custom paths by default.
 
Edho Arief <edho@myconan.net> 
parents: 
250 
diff
changeset
 | 
22 done | 
| 
 
4fe8668e3ef0
Awesome custom paths by default.
 
Edho Arief <edho@myconan.net> 
parents: 
250 
diff
changeset
 | 
23 | 
| 250 | 24 case "${TERM}" in | 
| 25 xterm*|dtterm*|screen*) | |
| 26 PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ ' | |
| 27 ;; | |
| 28 *) | |
| 29 PS1='[\u@\h \W]\$ ' | |
| 30 ;; | |
| 31 esac | |
| 
49
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
32 | 
| 
111
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
33 shopt -s histappend | 
| 
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
34 PROMPT_COMMAND='history -a' | 
| 
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
35 export HISTFILESIZE=10000 | 
| 
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
36 export HISTCONTROL=ignoredups | 
| 
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
37 | 
| 
53
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
38 export PAGER="less -Rins" | 
| 
49
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
39 export EDITOR=vi | 
| 
89
 
29bd7f6ef58a
Explicit LANG declaration.
 
Edho Prima Arief <me@myconan.net> 
parents: 
60 
diff
changeset
 | 
40 export LANG="en_US.UTF-8" | 
| 
101
 
a1c6b40a535f
Ensure no Ubuntuism's ls color bastardization.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
96 
diff
changeset
 | 
41 unset LS_COLORS | 
| 
49
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
42 | 
| 
53
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
43 alias less="less -Rins" | 
| 
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
44 #assuming POSIX grep | 
| 
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
45 alias fgrep="grep -F" | 
| 
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
46 alias egrep="grep -E" | 
| 62 | 47 alias ls="ls -F" | 
| 48 alias rm="rm -i" | |
| 
75
 
f993714efa7b
cool alias, bro (rdesktop)
 
Edho Prima Arief <me@myconan.net> 
parents: 
71 
diff
changeset
 | 
49 alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5" | 
| 
53
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
50 | 
| 43 | 51 _has_rm_I= | 
| 52 _has_gnu_ls= | |
| 
53
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
53 _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
 | 
54 _ls="ls" | 
| 43 | 55 case "$(uname -s)" in | 
| 56 Linux) | |
| 57 _has_rm_I=y | |
| 58 _has_gnu_ls=y | |
| 
96
 
26c9dc482051
Merge. Linux obviously has gnu grep.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
75 
diff
changeset
 | 
59 _has_gnu_grep=y | 
| 43 | 60 ;; | 
| 61 SunOS) | |
| 62 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y | |
| 63 [ -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
 | 
64 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y | 
| 
50
 
b7a63c71b07f
[bash] export PATH last, added various default solaris PATH.
 
Edho Prima Arief <me@myconan.net> 
parents: 
49 
diff
changeset
 | 
65 [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}" | 
| 
 
b7a63c71b07f
[bash] export PATH last, added various default solaris PATH.
 
Edho Prima Arief <me@myconan.net> 
parents: 
49 
diff
changeset
 | 
66 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}" | 
| 51 | 67 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}" | 
| 
247
 
3d57990fe9d1
Path adjustment for Solaris. Mainly for coping with Solaris 10.
 
Edho Arief <edho@myconan.net> 
parents: 
242 
diff
changeset
 | 
68 [ -d /usr/sfw/bin ] && PATH="${PATH}:/usr/sfw/bin" | 
| 
 
3d57990fe9d1
Path adjustment for Solaris. Mainly for coping with Solaris 10.
 
Edho Arief <edho@myconan.net> 
parents: 
242 
diff
changeset
 | 
69 [ -d /usr/xpg4/bin ] && PATH="${PATH}:/usr/xpg4/bin" | 
| 62 | 70 export PATH | 
| 
57
 
ada5b9534765
[bash] Sanitize sunos ping.
 
Edho Prima Arief <me@myconan.net> 
parents: 
56 
diff
changeset
 | 
71 alias ping="ping -s" | 
| 
 
ada5b9534765
[bash] Sanitize sunos ping.
 
Edho Prima Arief <me@myconan.net> 
parents: 
56 
diff
changeset
 | 
72 alias ping6="ping -A inet6" | 
| 43 | 73 ;; | 
| 
53
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
74 FreeBSD) | 
| 43 | 75 _has_rm_I=y | 
| 
111
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
76 export CLICOLOR= | 
| 
 
fd8dbd4bb758
ls color for freebsd, history control.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
106 
diff
changeset
 | 
77 export LSCOLORS=ExGxFxdxCxegedabagExEx | 
| 43 | 78 ;; | 
| 62 | 79 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
 | 
80 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
 | 
81 _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
 | 
82 _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
 | 
83 elif command -v colorls > /dev/null 2>&1; then | 
| 62 | 84 export CLICOLOR= | 
| 140 | 85 export LSCOLORS=ExGxFxdxCxegedabagExEx | 
| 62 | 86 alias ls='colorls -F' | 
| 87 fi | |
| 88 ;; | |
| 249 | 89 NetBSD) | 
| 90 export PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin" | |
| 91 if command -v gls > /dev/null 2>&1; then | |
| 92 _has_gnu_ls=y | |
| 93 _ls="gls" | |
| 94 elif command -v colorls > /dev/null 2>&1; then | |
| 95 export CLICOLOR= | |
| 96 export LSCOLORS=ExGxFxdxCxegedabagExEx | |
| 97 alias ls='colorls -F' | |
| 98 fi | |
| 99 ;; | |
| 67 | 100 CYGWIN*) | 
| 101 export PATH="${PATH}:${_org_path}" | |
| 102 ;; | |
| 43 | 103 esac | 
| 104 | |
| 62 | 105 [ "${_has_rm_I}" = y ] && alias rm="rm -I" | 
| 
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
 | 
106 [ "${_has_gnu_ls}" = y ] && alias ls="${_ls} -F --color=auto" | 
| 62 | 107 [ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto" | 
| 
53
 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 
Edho Prima Arief <me@myconan.net> 
parents: 
52 
diff
changeset
 | 
108 | 
| 
49
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
109 unset _has_rm_I | 
| 
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
110 unset _has_gnu_ls | 
| 58 | 111 unset _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
 | 
112 unset _ls | 
| 
49
 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 
Edho Prima Arief <me@myconan.net> 
parents: 
48 
diff
changeset
 | 
113 | 
| 
56
 
9343fa4dfd91
[bash] we have vim. Probably.
 
Edho Prima Arief <me@myconan.net> 
parents: 
55 
diff
changeset
 | 
114 | 
| 59 | 115 case "${TERM}" in | 
| 116 xterm*|screen*|dtterm) | |
| 141 | 117 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007";'"${PROMPT_COMMAND}" | 
| 59 | 118 ;; | 
| 119 esac | |
| 120 | |
| 
63
 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 
Edho Prima Arief <me@myconan.net> 
parents: 
62 
diff
changeset
 | 
121 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
 | 
122 alias vi=vim | 
| 
 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 
Edho Prima Arief <me@myconan.net> 
parents: 
62 
diff
changeset
 | 
123 export EDITOR=vim | 
| 
 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 
Edho Prima Arief <me@myconan.net> 
parents: 
62 
diff
changeset
 | 
124 fi | 
| 71 | 125 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after" | 
| 
117
 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 
Edho Prima Arief <edho@myconan.net> 
parents: 
112 
diff
changeset
 | 
126 | 
