comparison rc/bash @ 127:a7484f2c9616

Long-overdue massive reorganization.
author Edho Prima Arief <edho@myconan.net>
date Thu, 27 Oct 2011 16:23:23 +0700
parents bash@eacc854eae67
children 110d0ec96f7c
comparison
equal deleted inserted replaced
126:9a15f3d1b5b0 127:a7484f2c9616
1 #!/usr/bin/env bash
2
3 if [ "${ECOS_BASH_LOADED}" != "yes" ]; then
4 ECOS_BASH_LOADED="yes"
5 else
6 return
7 fi
8
9 [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
10
11 _org_path="${PATH}"
12 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
13
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\]]\$ '
16
17 shopt -s histappend
18 PROMPT_COMMAND='history -a'
19 export HISTFILESIZE=10000
20 export HISTCONTROL=ignoredups
21
22 export PAGER="less -Rins"
23 export EDITOR=vi
24 export LANG="en_US.UTF-8"
25 unset LS_COLORS
26
27 alias less="less -Rins"
28 #assuming POSIX grep
29 alias fgrep="grep -F"
30 alias egrep="grep -E"
31 alias ls="ls -F"
32 alias rm="rm -i"
33 alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
34
35 _has_rm_I=
36 _has_gnu_ls=
37 _has_gnu_grep=
38 case "$(uname -s)" in
39 Linux)
40 _has_rm_I=y
41 _has_gnu_ls=y
42 _has_gnu_grep=y
43 ;;
44 SunOS)
45 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
46 [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
47 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
48 [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}"
49 [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
50 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
51 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
52 export PATH
53 alias ping="ping -s"
54 alias ping6="ping -A inet6"
55 ;;
56 FreeBSD)
57 _has_rm_I=y
58 export CLICOLOR=
59 export LSCOLORS=ExGxFxdxCxegedabagExEx
60 ;;
61 OpenBSD)
62 if command -v colorls > /dev/null 2>&1; then
63 export CLICOLOR=
64 alias ls='colorls -F'
65 fi
66 ;;
67 CYGWIN*)
68 export PATH="${PATH}:${_org_path}"
69 ;;
70 esac
71
72 [ "${_has_rm_I}" = y ] && alias rm="rm -I"
73 [ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
74 [ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
75
76 unset _has_rm_I
77 unset _has_gnu_ls
78 unset _has_gnu_grep
79
80
81 case "${TERM}" in
82 xterm*|screen*|dtterm)
83 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
84 ;;
85 esac
86
87 if command -v vim > /dev/null 2>&1; then
88 alias vi=vim
89 export EDITOR=vim
90 fi
91 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"
92