Mercurial > ec-dotfiles
annotate rc/bash @ 238:5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
| author | Edho Arief <edho@myconan.net> | 
|---|---|
| date | Sun, 02 Oct 2011 07:22:57 +0700 | 
| parents | 735b21c05f54 | 
| children | ebfa844d2ef8 | 
| rev | line source | 
|---|---|
| 43 | 1 #!/usr/bin/env bash | 
| 2 | |
| 117 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 Edho Prima Arief <edho@myconan.net> parents: 
112diff
changeset | 3 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: 
117diff
changeset | 4 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: 
117diff
changeset | 5 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: 
117diff
changeset | 6 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: 
117diff
changeset | 7 fi | 
| 117 
548cf46e9cb4
Ensures no double loading using C-style variable test.
 Edho Prima Arief <edho@myconan.net> parents: 
112diff
changeset | 8 | 
| 71 | 9 [ -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: 
48diff
changeset | 10 | 
| 67 | 11 _org_path="${PATH}" | 
| 62 | 12 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: 
43diff
changeset | 13 | 
| 109 | 14 PS1='[\u@\h \W]\$ ' | 
| 15 #PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ ' | |
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 16 | 
| 111 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 17 shopt -s histappend | 
| 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 18 PROMPT_COMMAND='history -a' | 
| 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 19 export HISTFILESIZE=10000 | 
| 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 20 export HISTCONTROL=ignoredups | 
| 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 21 | 
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 22 export PAGER="less -Rins" | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 23 export EDITOR=vi | 
| 89 
29bd7f6ef58a
Explicit LANG declaration.
 Edho Prima Arief <me@myconan.net> parents: 
60diff
changeset | 24 export LANG="en_US.UTF-8" | 
| 101 
a1c6b40a535f
Ensure no Ubuntuism's ls color bastardization.
 Edho Prima Arief <edho@myconan.net> parents: 
96diff
changeset | 25 unset LS_COLORS | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 26 | 
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 27 alias less="less -Rins" | 
| 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 28 #assuming POSIX grep | 
| 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 29 alias fgrep="grep -F" | 
| 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 30 alias egrep="grep -E" | 
| 62 | 31 alias ls="ls -F" | 
| 32 alias rm="rm -i" | |
| 75 
f993714efa7b
cool alias, bro (rdesktop)
 Edho Prima Arief <me@myconan.net> parents: 
71diff
changeset | 33 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: 
52diff
changeset | 34 | 
| 43 | 35 _has_rm_I= | 
| 36 _has_gnu_ls= | |
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 37 _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: 
141diff
changeset | 38 _ls="ls" | 
| 43 | 39 case "$(uname -s)" in | 
| 40 Linux) | |
| 41 _has_rm_I=y | |
| 42 _has_gnu_ls=y | |
| 96 
26c9dc482051
Merge. Linux obviously has gnu grep.
 Edho Prima Arief <edho@myconan.net> parents: 
75diff
changeset | 43 _has_gnu_grep=y | 
| 43 | 44 ;; | 
| 45 SunOS) | |
| 46 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y | |
| 47 [ -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: 
52diff
changeset | 48 [ -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: 
52diff
changeset | 49 [ -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: 
49diff
changeset | 50 [ -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: 
49diff
changeset | 51 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}" | 
| 51 | 52 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}" | 
| 62 | 53 export PATH | 
| 57 
ada5b9534765
[bash] Sanitize sunos ping.
 Edho Prima Arief <me@myconan.net> parents: 
56diff
changeset | 54 alias ping="ping -s" | 
| 
ada5b9534765
[bash] Sanitize sunos ping.
 Edho Prima Arief <me@myconan.net> parents: 
56diff
changeset | 55 alias ping6="ping -A inet6" | 
| 43 | 56 ;; | 
| 53 
b9db5d89aae3
[bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
 Edho Prima Arief <me@myconan.net> parents: 
52diff
changeset | 57 FreeBSD) | 
| 43 | 58 _has_rm_I=y | 
| 111 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 59 export CLICOLOR= | 
| 
fd8dbd4bb758
ls color for freebsd, history control.
 Edho Prima Arief <edho@myconan.net> parents: 
106diff
changeset | 60 export LSCOLORS=ExGxFxdxCxegedabagExEx | 
| 43 | 61 ;; | 
| 62 | 62 OpenBSD) | 
| 238 
5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
 Edho Arief <edho@myconan.net> parents: 
141diff
changeset | 63 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: 
141diff
changeset | 64 _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: 
141diff
changeset | 65 _ls="gls" | 
| 
5dcbf6ab0109
Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
 Edho Arief <edho@myconan.net> parents: 
141diff
changeset | 66 elif command -v colorls > /dev/null 2>&1; then | 
| 62 | 67 export CLICOLOR= | 
| 140 | 68 export LSCOLORS=ExGxFxdxCxegedabagExEx | 
| 62 | 69 alias ls='colorls -F' | 
| 70 fi | |
| 71 ;; | |
| 67 | 72 CYGWIN*) | 
| 73 export PATH="${PATH}:${_org_path}" | |
| 74 ;; | |
| 43 | 75 esac | 
| 76 | |
| 62 | 77 [ "${_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: 
141diff
changeset | 78 [ "${_has_gnu_ls}" = y ] && alias ls="${_ls} -F --color=auto" | 
| 62 | 79 [ "${_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: 
52diff
changeset | 80 | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 81 unset _has_rm_I | 
| 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 82 unset _has_gnu_ls | 
| 58 | 83 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: 
141diff
changeset | 84 unset _ls | 
| 49 
b924652e169d
[bash] Various tweaks: prompt, unset for check variables, etc
 Edho Prima Arief <me@myconan.net> parents: 
48diff
changeset | 85 | 
| 56 
9343fa4dfd91
[bash] we have vim. Probably.
 Edho Prima Arief <me@myconan.net> parents: 
55diff
changeset | 86 | 
| 59 | 87 case "${TERM}" in | 
| 88 xterm*|screen*|dtterm) | |
| 141 | 89 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007";'"${PROMPT_COMMAND}" | 
| 59 | 90 ;; | 
| 91 esac | |
| 92 | |
| 63 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 93 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: 
62diff
changeset | 94 alias vi=vim | 
| 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 95 export EDITOR=vim | 
| 
b7814634220a
[bash] branch merge, added EDITOR change to vim when detected.
 Edho Prima Arief <me@myconan.net> parents: 
62diff
changeset | 96 fi | 
| 71 | 97 [ -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: 
112diff
changeset | 98 | 
