Mercurial > ec-dotfiles
annotate bash @ 54:fd518e13cf4d
[bash] for some reason solaris' PS1 \$ doesn't default to #.
author | Edho Prima Arief <me@myconan.net> |
---|---|
date | Thu, 28 Apr 2011 14:32:59 +0700 |
parents | b9db5d89aae3 |
children | c6d78ab9af22 |
rev | line source |
---|---|
43 | 1 #!/usr/bin/env bash |
2 | |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
3 [ -f .ecos_bash.before ] && . .ecos_bash.before |
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
4 |
50
b7a63c71b07f
[bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents:
49
diff
changeset
|
5 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
|
6 |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
7 PS1="[\u@\h \W]\$ " |
54
fd518e13cf4d
[bash] for some reason solaris' PS1 \$ doesn't default to #.
Edho Prima Arief <me@myconan.net>
parents:
53
diff
changeset
|
8 [ "$UID" = "0" ] && 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" |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
17 |
43 | 18 _has_rm_I= |
19 _has_gnu_ls= | |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
20 _has_gnu_grep= |
43 | 21 _has_bsd_ls= |
22 case "$(uname -s)" in | |
23 Linux) | |
24 _has_rm_I=y | |
25 _has_gnu_ls=y | |
26 ;; | |
27 SunOS) | |
28 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y | |
29 [ -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
|
30 [ -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
|
31 [ -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
|
32 [ -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
|
33 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}" |
51 | 34 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}" |
43 | 35 ;; |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
36 FreeBSD) |
43 | 37 _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
|
38 CLICOLOR= |
43 | 39 ;; |
40 esac | |
52
d07ce874a280
[bash] securing test. Should use bashism but I hate bashism.
Edho Prima Arief <me@myconan.net>
parents:
51
diff
changeset
|
41 if [ "${_has_rm_I}" = y ]; then |
43 | 42 alias rm="rm -I" |
43 else | |
44 alias rm="rm -i" | |
45 fi | |
46 | |
52
d07ce874a280
[bash] securing test. Should use bashism but I hate bashism.
Edho Prima Arief <me@myconan.net>
parents:
51
diff
changeset
|
47 if [ "${_has_gnu_ls}" = y ]; then |
43 | 48 alias ls="ls -F --color=auto" |
49 else | |
50 alias ls="ls -F" | |
51 fi | |
52 | |
53
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
53 if [ "${_has_gnu_grep}" = y ]; then |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
54 alias grep="grep --color=auto" |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
55 fi |
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents:
52
diff
changeset
|
56 |
49
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
57 unset _has_rm_I |
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
58 unset _has_gnu_ls |
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
59 unset _has_bsd_ls |
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents:
48
diff
changeset
|
60 |
50
b7a63c71b07f
[bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents:
49
diff
changeset
|
61 export PATH |
48
416f9d3e9ee8
[bash] Forgot the .bash.conf => .ecos_bash change.
Edho Prima Arief <me@myconan.net>
parents:
44
diff
changeset
|
62 [ -f .ecos_bash.after ] && . .ecos_bash.after |