Mercurial > ec-dotfiles
annotate bash @ 71:40236fd0a3a5
Explicit path checking.
author | Edho Prima Arief <me@myconan.net> |
---|---|
date | Mon, 23 May 2011 00:01:20 +0700 |
parents | 4510c8a9d8ec |
children | f993714efa7b |
rev | line source |
---|---|
43 | 1 #!/usr/bin/env bash |
2 | |
71 | 3 [ -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
|
4 |
67 | 5 _org_path="${PATH}" |
62 | 6 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
|
7 |
55
c6d78ab9af22
[bash] turns out one of those that requires '.
Edho Prima Arief <me@myconan.net>
parents:
54
diff
changeset
|
8 PS1='[\u@\h \W]\$ ' |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
9 |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
10 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
|
11 export EDITOR=vi |
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
12 |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
13 alias less="less -Rins" |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
14 #assuming POSIX grep |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
15 alias fgrep="grep -F" |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
16 alias egrep="grep -E" |
62 | 17 alias ls="ls -F" |
18 alias rm="rm -i" | |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
19 |
43 | 20 _has_rm_I= |
21 _has_gnu_ls= | |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
22 _has_gnu_grep= |
43 | 23 case "$(uname -s)" in |
24 Linux) | |
25 _has_rm_I=y | |
26 _has_gnu_ls=y | |
27 ;; | |
28 SunOS) | |
29 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y | |
30 [ -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
|
31 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
32 [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}" |
50
b7a63c71b07f
[bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents:
49
diff
changeset
|
33 [ -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
|
34 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}" |
51 | 35 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}" |
62 | 36 export PATH |
57
ada5b9534765
[bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents:
56
diff
changeset
|
37 alias ping="ping -s" |
ada5b9534765
[bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents:
56
diff
changeset
|
38 alias ping6="ping -A inet6" |
43 | 39 ;; |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
40 FreeBSD) |
43 | 41 _has_rm_I=y |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
42 CLICOLOR= |
43 | 43 ;; |
62 | 44 OpenBSD) |
45 if command -v colorls > /dev/null 2>&1; then | |
46 export CLICOLOR= | |
47 alias ls='colorls -F' | |
48 fi | |
49 ;; | |
67 | 50 CYGWIN*) |
51 export PATH="${PATH}:${_org_path}" | |
52 ;; | |
43 | 53 esac |
54 | |
62 | 55 [ "${_has_rm_I}" = y ] && alias rm="rm -I" |
56 [ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto" | |
57 [ "${_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
|
58 |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
59 unset _has_rm_I |
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
60 unset _has_gnu_ls |
58 | 61 unset _has_gnu_grep |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
62 |
56
9343fa4dfd91
[bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents:
55
diff
changeset
|
63 |
59 | 64 case "${TERM}" in |
65 xterm*|screen*|dtterm) | |
60
be4d0b045487
[bash] LOGNAME instead of USER since the former is more widely available (ie. USER is not set after `sudo su -` on solaris).
Edho Prima Arief <me@myconan.net>
parents:
59
diff
changeset
|
66 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"' |
59 | 67 ;; |
68 esac | |
69 | |
63
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
70 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
|
71 alias vi=vim |
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
72 export EDITOR=vim |
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents:
62
diff
changeset
|
73 fi |
71 | 74 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after" |