Mercurial > ec-dotfiles
comparison bash @ 62:996aa2f81721
[bash] various fixes:
- export the path first thing - also add export on sunos case.
- alias early
- unused _has_bsd_ls
- added openbsd, check for colorls which is an awesome command
author | Edho Prima Arief <me@myconan.net> |
---|---|
date | Fri, 06 May 2011 03:15:24 +0700 |
parents | be4d0b045487 |
children | b7814634220a |
comparison
equal
deleted
inserted
replaced
60:be4d0b045487 | 62:996aa2f81721 |
---|---|
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 | 2 |
3 [ -f .ecos_bash.before ] && . .ecos_bash.before | 3 [ -f .ecos_bash.before ] && . .ecos_bash.before |
4 | 4 |
5 PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" | 5 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" |
6 | 6 |
7 PS1='[\u@\h \W]\$ ' | 7 PS1='[\u@\h \W]\$ ' |
8 | 8 |
9 export PAGER="less -Rins" | 9 export PAGER="less -Rins" |
10 export EDITOR=vi | 10 export EDITOR=vi |
11 | 11 |
12 alias less="less -Rins" | 12 alias less="less -Rins" |
13 #assuming POSIX grep | 13 #assuming POSIX grep |
14 alias fgrep="grep -F" | 14 alias fgrep="grep -F" |
15 alias egrep="grep -E" | 15 alias egrep="grep -E" |
16 alias ls="ls -F" | |
17 alias rm="rm -i" | |
16 | 18 |
17 _has_rm_I= | 19 _has_rm_I= |
18 _has_gnu_ls= | 20 _has_gnu_ls= |
19 _has_gnu_grep= | 21 _has_gnu_grep= |
20 _has_bsd_ls= | |
21 case "$(uname -s)" in | 22 case "$(uname -s)" in |
22 Linux) | 23 Linux) |
23 _has_rm_I=y | 24 _has_rm_I=y |
24 _has_gnu_ls=y | 25 _has_gnu_ls=y |
25 ;; | 26 ;; |
29 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y | 30 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y |
30 [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}" | 31 [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}" |
31 [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}" | 32 [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}" |
32 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}" | 33 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}" |
33 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}" | 34 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}" |
35 export PATH | |
34 alias ping="ping -s" | 36 alias ping="ping -s" |
35 alias ping6="ping -A inet6" | 37 alias ping6="ping -A inet6" |
36 ;; | 38 ;; |
37 FreeBSD) | 39 FreeBSD) |
38 _has_rm_I=y | 40 _has_rm_I=y |
39 CLICOLOR= | 41 CLICOLOR= |
40 ;; | 42 ;; |
43 OpenBSD) | |
44 if command -v colorls > /dev/null 2>&1; then | |
45 export CLICOLOR= | |
46 alias ls='colorls -F' | |
47 fi | |
48 ;; | |
41 esac | 49 esac |
42 if [ "${_has_rm_I}" = y ]; then | |
43 alias rm="rm -I" | |
44 else | |
45 alias rm="rm -i" | |
46 fi | |
47 | 50 |
48 if [ "${_has_gnu_ls}" = y ]; then | 51 [ "${_has_rm_I}" = y ] && alias rm="rm -I" |
49 alias ls="ls -F --color=auto" | 52 [ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto" |
50 else | 53 [ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto" |
51 alias ls="ls -F" | |
52 fi | |
53 | |
54 if [ "${_has_gnu_grep}" = y ]; then | |
55 alias grep="grep --color=auto" | |
56 fi | |
57 | 54 |
58 unset _has_rm_I | 55 unset _has_rm_I |
59 unset _has_gnu_ls | 56 unset _has_gnu_ls |
60 unset _has_gnu_grep | 57 unset _has_gnu_grep |
61 unset _has_bsd_ls | |
62 | 58 |
63 export PATH | |
64 | 59 |
65 case "${TERM}" in | 60 case "${TERM}" in |
66 xterm*|screen*|dtterm) | 61 xterm*|screen*|dtterm) |
67 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"' | 62 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"' |
68 ;; | 63 ;; |